Remove password

T

ToyFixer

I have set passwords for Excel files through
SaveAs>Tools>General Options>Password to Open...

The users are allowed to use these password protected Excel files (for data
entry) through a MSAccess Database which I created to manage the files. When
the users select the files they want to use, the password is passed through
the code and opens the file for them.

Now the problem is the users want a copy of the Excel files for their
reporting needs. So far I have managed to save a copy of the original Excel
file on the user's desktop for them. How do I remove the password when I give
a copy to the users?

I tried
ThisWorkbook.Unprotect ("password") and
ActiveWorkbook.Unprotect("password")

But they don't seem to remove the password required to open the file which
was set in the Save As dialogue box.
Can anyone point me in the direction how to achieve this?

Thanks in advance
Toyfixer
 
T

Tom Ogilvy

do a saveas without supplying a password. Choose to overwrite the existing
file.
 
T

ToyFixer

Thank you for the reply Tom.

I managed to work it out myself. I used
ThisWorkbook.SaveAs Filename:=WshShell.SpecialFolders("Desktop") & "\"
& ThisWorkbook.Name, password:=""
It removed the password of original file had, from the copy on the desktop
 
T

Tom Ogilvy

Just like I said - use saveas

ThisWorkbook.SaveAs Filename:=WshShell.SpecialFolders("Desktop") & "\"
& ThisWorkbook.Name

would have worked as well.
 
T

ToyFixer

Hi Tom,
Thank you again for the valuable input.

But it didn't get rid of the password without the 'password:=""' option.
Maybe I have got something else which prevents it getting rid of the
password without it. However, it works fine now.

Thank you again.
Toyfixer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top