Closing VBA editior programmatically

  • Thread starter Thread starter Shatin
  • Start date Start date
S

Shatin

I have a macro which ends like this:

With ActiveWorkbook.VBProject.VBComponents("ThisWorkbook").CodeModule
StartLine = .CreateEventProc("BeforeClose", "Workbook") + 1
.InsertLines StartLine, _
"Msgbox ""Blahblahblahblah...."",vbOkOnly"
End With

When I run the macro, it does whatever it has to do and then ends by
displaying the code module window with the above code. This will
puzzle my friends who will run the macro since they don't know a thing
about VBA. How can I close the VBA editor programmatically?

Thanks in advance!
 
Back
Top