Stop execution of ThisWorkBook Code

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
 
D

Dave Peterson

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.)
 

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