Discussion Locked

Macro to input password for read only workbooks

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have several workbooks that I need to open and recalculate often. All of these workbooks are read only is you don't have the password. I want write a macro to open all of these workbooks and to automatically enter the password as they open instead of me typing it in 50 times. I have tried searching the database, but I can't find anything that has worked. I know how to make the macro to open the workbooks, I just don't know the syntax to enter the password. Any help will be very very appreciated.

1 reply

by dusemre

For workbook protection
active.workbook.password ("password")

For worksheet protection
active.worksheet.password ("password")

Note: do not omit " in the password field, write your password inside ("")

when writing the code dont forget to choose worksheet, example:

where;
sheet name is SKOR
sheet password is 123456

Sheets("SKOR").Select
ActiveSheet.Unprotect ("123456")

This discussion is closed to new replies.