ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Stop execution of ThisWorkBook Code (https://www.excelbanter.com/excel-programming/317358-stop-execution-thisworkbook-code.html)

Anirban

Stop execution of ThisWorkBook Code
 

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").VBCom ponents("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

--
Anirba
-----------------------------------------------------------------------
Anirban's Profile: http://www.excelforum.com/member.php...nfo&userid=987
View this thread: http://www.excelforum.com/showthread.php?threadid=31872


Dave Peterson[_5_]

Stop execution of ThisWorkBook Code
 
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.)



Anirban wrote:

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

Application.VBE.VBProjects("YourVBAProject").VBCom ponents("ThisWorkbook").CodeModule.AddFromFile
"FileName.txt"

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

How do I do this?

--
Anirban
------------------------------------------------------------------------
Anirban's Profile: http://www.excelforum.com/member.php...fo&userid=9871
View this thread: http://www.excelforum.com/showthread...hreadid=318724


--

Dave Peterson


All times are GMT +1. The time now is 07:31 PM.

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