Results 1 to 2 of 2
  1. #1
    pilot
    Guest

    Password setting from code

    I've got the following problem: The setting of a password to protect a module within ms word 97 is done manually by selecting the properties of the vb project in the vb editor and then typing in a password on the apropiate tab.

    I want to do the same but in VBA code. I need to know how to set and most of all remove the passwordprotection from the VBA project.

    Please do not be confused: I know how to set and disable the protection of the actual document. I just need the same for the VBA project.

    Hope anyone can help me.

    greetz,
    Pilot

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

    Re: Password setting from code

    Hi Pilot,

    Unfortunately it looks like this can't be set via code.
    The VB help says that the Protection property for a VBProject:

    <pre>Returns a value indicating the state of protection of a project. Read-only.

    Return Values

    The Protection property return values are:

    Constant Description
    vbext_pp_locked The specified project is locked.
    vbext_pp_none The specified project isn't protected.
    </pre>

    And gives the following example:

    Protection Property Example
    The following example uses the Protection property to return a value indicating whether or not a project is protected. The value returned is a number that corresponds to a predefined constant representing the project's status.

    Debug.Print Application.VBE.ActiveVBProject.Protection

    Gary

Posting Permissions

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