Protect VBA Project By Macro

K

K

Hi all, I am looking for macro with which i can password protect
other Workbooks VBA Projects. I know you can do it by sendkeys but
can please anyone know what will be the full macro code if i want to
protect VBA Project of some other Workbook. Like if i click button
from Workbook A then it should protect VBA Project of Workbook B.
 
S

sameoldcalvin

you could try the following:

so when you click button from workbook A....

Workbooks.Open Filename:= "C:\workbookB.xls"
ActiveWorkbook.Protect Structure:=True, Windows:=False
ActiveWorkbook.Save
ActiveWindow.Close
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top