Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Jun 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Disable Save and Print (VB 6 / Word 97)

    I am trying, with limited success, to disable the SaveAs and Print options within Word 97. Why am I doing this? Well I need to launch a controlled word document from within a VB app, but the users are not permitted to create a locally stored copy or to print to a local printer; all this is handled by the VB app to ensure that business documents that are dispatched are exactly the same as those that are stored in the document store.
    Now, I have managed to disable the file menu and to trap the keystrokes mapped to Print and Save but this seems a bit flimsy. Does anyone know a way of trapping the actual print and save commands to make this whole thing a bit more robust.

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Disable Save and Print (VB 6 / Word 97)

    You can probably do what you want by setting the Cancel value in the DocumentBeforePrint and DocumentBeforeSave events in an application class module. Have a look at <post#=196505>post 196505</post#> if you would like to see an example of how to establish an event handling class module.

    You do need to be very sure that the user can't disable VB from running, which might be tricky.

    StuartR

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Disable Save and Print (VB 6 / Word 97)

    I think Word 97 was somewhat limited in the events it offered you. Back then, we created macros with the names of the commands to make Word do our bidding.

    Sub FilePrint()
    MsgBox "You must not print!"
    End Sub

    Sub FileSaveAs()
    MsgBox "You must not Save As!"
    End Sub

    and so forth. You can guess most of the names, but a few are based on Word 6 menus (such as FileTemplates), so those might not jump out at you.

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Disable Save and Print (VB 6 / Word 97)

    Woops, I missed the fact that this was Word97

    StuartR

  5. #5
    New Lounger
    Join Date
    Jun 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disable Save and Print (VB 6 / Word 97)

    Jefferson/Stuart,

    Thanks for your help; Jefferson's FileSave, FilePrint, etc seems to do the job.

  6. #6
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Disable Save and Print (VB 6 / Word 97)

    Jefferson,
    Did the Ctrl-Alt-+ (i.e. hold Control, Alt and the + key on the numeric keypad) trick work in Word 97 for determining the command names? Quite handy for those you can't guess.
    FWIW.
    Regards,
    Rory

    Microsoft MVP - Excel

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Disable Save and Print (VB 6 / Word 97)

    That sounds like one of Phil's tips. Given how long ago it was posted, I suspect the answer is Yes, but I'm not in a position to confirm.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •