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!
 

Some videos you may like

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

9ballpimp

Board Regular
Joined
Jan 26, 2005
Messages
141
What exactly are you trying to do? Do you want to open all 35 at the same time?? Please provide more details.

9ballpimp
 

freda

New Member
Joined
Dec 22, 2004
Messages
45
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 :)
 

Watch MrExcel Video

Forum statistics

Threads
1,123,328
Messages
5,600,985
Members
414,418
Latest member
mightyMagnus

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
Top