Results 1 to 7 of 7
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Protecting a macro or templage (Word 2000)

    I know how to set a password to a project to prevent users from viewing my code. However, I have some built in macros in words where the edit box is gray. That means, when users click on the macro, the edit button will be disable. I want to know if this can be done or can be done programamatically. I have seen that in some macros provided by MS. I also want to know if MS is only the one who can do it.

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting a macro or templage (Word 2000)

    If the project is password protected, the Edit button is unavailable.

  3. #3
    Star Lounger
    Join Date
    Apr 2002
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting a macro or templage (Word 2000)

    I password protected the project. The edit button is still available. Password protected only ask users for password. When I password protected my project, the edit button did not turn gray.

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    New York
    Posts
    214
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting a macro or templage (Word 2000)

    If your password protected project is loaded as template attached to a document or loaded directly as if it were a document, then the edit button is not greyed and you will be asked for a password when Edit is clicked.

    If, however, the same project is placed in the Startup folder and loaded by Word directly as an add-in, then the Edit button will be greyed.

  5. #5
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Protecting a macro or templage (Word 2000)

    In some (many) cases it may be more appropriate to keep the code in an attached template rather than a global template.

    Although you can't grey out the Edit button for macros that are in an attached template, you can keep them appearing in the list altogther. A few ways to do that:
    <UL><LI>Make them into Subs that take arguments (or Functions for that matter).
    <LI>Make them Private rather than Public Subs (only callable by other Subs in the same module)
    <LI>Put an "Option Private Module" declaration at the top of any code module housing Subs you don't want the user to see in the Macros list. These Subs will be callable by any other sub in the same project, but not by any sub in any other project.[/list]Gary

  6. #6
    Star Lounger
    Join Date
    Apr 2002
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting a macro or templage (Word 2000)

    I have figured it out by ocpying my template to the startup directory. However when I dod that, my template become global. I don't know much about global template, however I don't like it. I assume in a global template, the macros are available to any templte. I don't like that. I want my macros to be available only wihin my template. For that reason, I seems like it is not good to get the edit button gray.

    Is there another I can't do it to avoid the global templage?

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    New York
    Posts
    214
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting a macro or templage (Word 2000)

    You were asking why some templates it's greyed and some templates it's not (though still protected by password).

    That's what I was explaining.

    No, there's no way to *grey* the edit button and still have the macros listed in the ToolsMacro list other than making it a global add-in.

    To keep it just in the template context they will be visible.

    What difference does it make if they are visible and the Edit is visible if the Edit doesn't allow editing?

    The other solution, as pointed out by a previous reply, is to take them out of the lists entirely by re-writing your code to use Functions and Private Subs.

Posting Permissions

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