Stop execution of ThisWorkBook Code

  • Thread starter Thread starter Anirban
  • Start date Start date
A

Anirban

I am using EXCEL 97 and I am adding ThisWorkBook module which ha
WorkBook_Open, _BeforeClose, _BeforeSave, _Activate and _Deactivat
events
declared through Code (using VB application extensibility library)

Application.VBE.VBProjects("YourVBAProject").VBComponents("ThisWorkbook").CodeModule.AddFromFil
"FileName.txt"

As soon as the code is copied, it is auto executing. I would like t
stop its execution, close it and reopen it to start execution.

How do I do this
 
In my simple testing (xl2002, though), I couldn't duplicate this.

but maybe you could try:

application.enableevents = false
'your addfromfile code
application.enableevents = true

(the _activate and _deactivate events didn't seem to fire in my testing.)
 
Back
Top