• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Unlocking a VBA project knowing the password

Costas

Member
Hi Chandoo,

I've created Timesheets for each branch of the business as separate workbooks and have a summary workbook that opens and imports the completed data. As all files have confidential information I had to put in place a lot of controls using macros in all files and locked the vba projects. I'm using the same password for the summary and all the branch vba projects.

Some procedures of the summary workbook, require running procedures from within the branch workbooks but because their projects are locked, these procedures are skipped.

Is there any way of unlocking the branch vba projects, running the procedure and on close locking them back to the same password?

Thanks
Costas
 
Code:
Sub MyCode()

ActiveSheet.unprotect "yourPassword"

'Put your code here

ActiveSheet.protect "yourPassword", DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
 
Hi Hui,

I've tried that but no joy. Maybe I wasn't clear on what I'm after.

Through vba, I want to open a file and unlock its code so I can run the macro within the opened file.
 
You shouldn't need to unlock the code to run the macro?
You will have to open the file

can you post the file here with some instructions on what you are trying to do ?
 
Back
Top