Simple way to add Event Proc skeleton in a sheet module

'Here is the code to add an Activate event to the sheet module.
Sub CreateEventProcedure(wks As Worksheet, strEvtProc As String) With ActiveWorkbook.VBProject.VBComponents(wks.CodeName).CodeModule 'Add the blank procedure .CreateEventProc strEvtProc, "Worksheet" End With End Sub Sub TestProc() Call CreateEventProcedure(ThisWorkbook.Worksheets("Sheet2"), "Activate") MsgBox "Goto Sheet2 module in the code window. The activate procedure skeleton is added.", vbInformation, "Excel Experts" End Sub
»
- Vishesh's blog
- Login or register to post comments
- 5875 reads
The procedure does not get
This is what it is supposed
This is what it is supposed to do...add only the Event procedures.