socallilly
asked on
Excel macro - Save & PW Protect workbooks using range w/file path names&pws
I have the need to make changes to 64 excel 2010 workbooks located in various folders in a directory. These workbooks and their worksheets are password protected. The sheets are all protected with the same pw, the workbook protection passwords change. I store the full path/filename in column "A" of a workbook where I start the macro. It's sheet is called 'Wbklist'. I store the workbook password in Column "B". I've pieced together a routine that I'd like to use to open each sheet and make the same correction to each sheet or poll the data within. The macro loops through each sheet in column A and unprotects the workbook and sheets. After the changes or polling is done, I cant seem to lock the workbooks back down again. The worksheets are being password protected just fine, the workbook is not. Ive tried a million little things and I dont know what Im doing wrong. When I open an individual workbook after its run, the workbook is not passwork protected.
Thanks in advance for your assistance!
PW-Protect-Quest.txt
Thanks in advance for your assistance!
PW-Protect-Quest.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
THANKS SO MUCH HARRY!!!!! I LOVE YOU!!!!!!
I think you have some error on your macro.
1) in your
Open in new window
You already have the file opened. and you don't need to open it again inOpen in new window
I have modified you code a little so that I don't have so many sheets per file, and the WB protect works just fine.
Which version of Excel are you using?
Have you tried change
WBSsource.Protect FilePW, Structure:=True, Windows:=False
to Activeworkbook.Protect FilePW, Structure:=True, Windows:=False