ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening a file and disabling open events (https://www.excelbanter.com/excel-programming/383833-opening-file-disabling-open-events.html)

Nigel RS[_2_]

Opening a file and disabling open events
 
Hi All
I have a an application (workbook) running some VBA code, I want this code
to open another application (workbook) but prevent its open events being
fired to prevent the opened workbook VBA code running.

How do I do this?

Cheers





Chip Pearson

Opening a file and disabling open events
 
Nigel,

Something like the following should work. You'll probably want to add some
error checking.

Dim WB As Workbook
Application.EnableEvents = False
Set WB = Workbooks.Open("C:\Book1.xls")
Application.EnableEvents = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Nigel RS" wrote in message
...
Hi All
I have a an application (workbook) running some VBA code, I want this code
to open another application (workbook) but prevent its open events being
fired to prevent the opened workbook VBA code running.

How do I do this?

Cheers







Nigel RS[_2_]

Opening a file and disabling open events
 
Thanks Chip, works a dream!

"Chip Pearson" wrote:

Nigel,

Something like the following should work. You'll probably want to add some
error checking.

Dim WB As Workbook
Application.EnableEvents = False
Set WB = Workbooks.Open("C:\Book1.xls")
Application.EnableEvents = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Nigel RS" wrote in message
...
Hi All
I have a an application (workbook) running some VBA code, I want this code
to open another application (workbook) but prevent its open events being
fired to prevent the opened workbook VBA code running.

How do I do this?

Cheers









All times are GMT +1. The time now is 01:10 AM.

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