Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Mar 2002
    Location
    Omaha, Nebraska, USA
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Accessing Macros in a protected document (2000 SR-1)

    How do you access a macro in a protected document? When I protect the document, the macros option under Tools>>Macro is disabled (greyed out). I have tried creating different sections and only protecting one section with the same result. There has to be an easy solution to this.

  2. #2
    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: Accessing Macros in a protected document (2000 SR-1)

    You can insert a MACROBUTTON field in the form. Since a MACROBUTTON field cannot take focus in a protected section, it needs to be double-clicked quickly (or the focus slides to the next field and the button never actually is activated). It might work better to place it in an unprotected section, if your form permits. Not an ideal solution either way. In most cases, it is easier to run a macro using the Enter and Exit macro options for a field.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Accessing Macros in a protected document (2000 SR-1)

    You can assign a keyboard shortcut to a macro and store it in the document itself or in the template it's based on.
    You can create a custom toolbar button or menu item in the document itself or in the template it's based on.
    These will also work if the document is protected.

    (I'm using Word 2002; I don't know if Word 2000 allows you to store keyboard and toolbar customizations in the document itself)

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Accessing Macros in a protected document (2000 SR-1)

    Hi Hans:
    Word 2000 does allow you to store keyboard customizations in a document. However, using any of the methods that you & Jefferson mention only allow certain commands to run. I find that any command which is unavailable for a protected document will still not work, unless I'm misunderstanding you. e.g. the command FormatFont (assigned to Ctrl+D) will not run in a protected document, nor will a macro that attempts to run that command unless it first unprotects the document.
    Cheers,

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Accessing Macros in a protected document (2000 SR-1)

    Phil,

    You are entirely correct. I only wanted to point out that there are several ways to start a macro in a protected document, even though the Tools | Macro | Macros menu item is disabled. Those macros can only execute instructions that are allowed in a protected document, unless the macro unprotects the document, executes some code, and then reprotects the document.

    Although it has come up many times before, this might be a good moment to mention for the benefit of others reading this thread that unprotecting, then re-protecting a document for forms will clear all form text boxes and check boxes, and reset dropdown lists. This can be avoided in code by adding an extra argument:

    ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

Posting Permissions

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