Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Mar 2003
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Project Protecion (2000/XP)

    I have locked a project for viewing and have set a password to view the project properties. This is working fine on my machine, I can access the code using the password I have set. I have distributed the excel file with the code to users who are able to work with the file, however on exiting the file the users are being prompted to enter the VBA Project password? They can click on Cancel twice and the message goes away but does anyone know why this might be happening?

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

    Re: Project Protecion (2000/XP)

    My guess is that the file has changed and Excel will not save the file unless given the password.

  3. #3
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Project Protecion (2000/XP)

    If you do something in the code that "changes" (according to Excel) the file with the code, then you get prompted to save that file and therefore the password is needed. You can avoid that by adding a line of code that sets the Saved flag.
    Personally I don't have much experience with Excel VBA, but I suppose it's not too different from Word VBA. So depending on the actual situation the line of code can be either:
    ActiveWorkbook.Saved = True
    Workbooks(i).Saved = True (i = indexnumber)
    Workbooks("name.xls").Saved = True (replace with actual name of file)
    etc.

    Place this line of code after the code that "changes" the file, or place it in an AutoClose Sub.

    Regards,
    Jan

Posting Permissions

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