Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Apply passwords to open on multiple files

Scenario: one folder(x) contains 3 files (without a password to open) name
a, b, & c. A separate file(z) contains a list of file names and
corresponding passwords for files in folder(x). See below:

File Password
a 123
b 456
c 789

What I would like is to build a macro that cycles through the files in
folder(x), looks up the corresponding password in the password file(z), and
applies as open-file passwords to the files in folder(x).

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Apply passwords to open on multiple files

Hi,

It would be simpler to start with the list in file z, instead of folder
x

'cycle through rows in file z

myworkbook=some_range_from_file_z
mypassword=some_range_from_file_z

Workbook.Open myworkbook 'don't forget to include full path!!!
ActiveWorkbook.Protect Password:=mypassword, Structu=True,
Windows:=False

'next cycle

If you insist on cycling through the folder, you should use
FileScriptingObject, or FSO. Some cool examples can be googled.
Regards,
ManualMan

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open multiple files J Setting up and Configuration of Excel 4 December 17th 07 05:30 PM
Open multiple files into multiple worksheets of the same workbook lil Matt Excel Discussion (Misc queries) 1 October 31st 06 09:03 PM
open multiple files Dennis S. Excel Discussion (Misc queries) 1 April 28th 06 05:10 PM
Apply VBA function to multiple excel files mate Excel Programming 2 May 7th 04 05:33 PM
Apply password to multiple Excel Files? gdavi Excel Programming 3 January 7th 04 04:57 AM


All times are GMT +1. The time now is 02:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"