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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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