Password Protected File

DWB82

New Member
Joined
Jun 4, 2015
Messages
18
Hi,

Is there any reason why this should not work:

Workbooks.Open Filename:="S:\Stafford\Training Files\17. New_Training_Tracker\Template-Staff-Training-Manager-Database V1.2.xlsm", Password:="password", writerespassword:="password"

I have also tried:

Workbooks.Open Filename:="S:\Stafford\Training Files\17. New_Training_Tracker\Template-Staff-Training-Manager-Database V1.2.xlsm", writerespassword:="password", Password:="password"


I am having trouble findinding any other macro than the above.

Each time i run the Macro it's prompting me to enter the password. And i've verified that the password entered above is the same password i use to manually open the file.

any assistance is greatly appreciated.

thank you.​
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
That code is correct. Are you 100% certain that the password you entered is correct, and are you sure it's the password for that file that you are being prompted for, and not say a linked file?
 
Upvote 0
Hi

Thank you for your response. I am 100% sure that the password is correct. When the password is entered manually the file then opens up without any further prompts eg open as ReadOnly.

I am positive that the password is for that file as no other files are linked to it etc.

Thanks again for any assistance that can be given
 
Last edited:
Upvote 0
Which password is actually set? One to open, or one to modify?
 
Upvote 0
And it's definitely a standard Excel open password, not something created by the code in that file?
 
Upvote 0
the password is one that was added by going to:
File
save As
Tools
General Options
the password has then been entered on the top line "password to Open"
 
Upvote 0
If that's the only one, you don't need the writerespassword:="password" part, but it should work with or without that. Also, if the password were wrong to open it, you should get an error, not a prompt.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top