ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   VBA Password Question (https://www.excelbanter.com/excel-worksheet-functions/157129-vba-password-question.html)

Danny

VBA Password Question
 
Hi,

I found the Create Event Procedure macro below from Mr. Chip Pearson's
website that is very helpful to my project.

Dim StartLine As Long
With ActiveWorkbook.VBProject.VBComponents("ThisWorkboo k").CodeModule
StartLine = .CreateEventProc("Open", "Workbook") + 1
.InsertLines StartLine, _
"Msgbox ""Hello World"",vbOkOnly"
End With

However, the macro won't work if the VBA is protected.

Is there a way that the macro above be edited to unprotect the VBA (say
password is "ABCD"), then, the above macro will run, then, the VBA will be
protected with the same password?

Thank you.



All times are GMT +1. The time now is 02:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com