vba to open multiple password protected workbooks

freda

New Member
Joined
Dec 22, 2004
Messages
45
I have 35 workbooks, all with a different password.

I have started writing vba along the lines of:

Code:
Workbooks.Open FileName:= _
        "\\00 Quotes and orders 2005\Aberdeen.xls", Password:="password1", WriteResPassword:="password1"
       Workbooks.Open FileName:= _
        "\\00 Quotes and orders 2005\Birmingham.xls", Password:="password2", WriteResPassword:="password2"

..but it would get rather long winded to do all 35 like this.

I don't know much about arrays, but have the idea in my head that if I set up a loop of some sort to reference the file name and password each time (all files are in the same folder) it would make my life a lot easier.

Could anyone help? Thank you!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
What exactly are you trying to do? Do you want to open all 35 at the same time?? Please provide more details.

9ballpimp
 
Upvote 0
Initially I want to open all 35, so I can have a look at them whenever I want to .

In the long run, I want to open each one, copy a selection of data from it, paste it into a master workbook, close it, and go on to the next one until they are all done.

Does this help? Thanks for responding :)
 
Upvote 0

Forum statistics

Threads
1,214,845
Messages
6,121,902
Members
449,053
Latest member
Guy Boot

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