ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable AutoOpen macro's (https://www.excelbanter.com/excel-programming/279719-disable-autoopen-macros.html)

Michael Beckinsale

Disable AutoOpen macro's
 
Hi All,

I have a macro that l run from a workbook which requires a second workbook
to be opened.

The second workbook contains a AutoOpen macro, the code of which is in the
ThisWorbook object. The AutoOpen macro prompts the user for Yes/No answers
upon opening via message boxes.

I would like to disable the AutoOpen macro on the second workbook when it is
opened via the VBA code in the 1st workbook.

The code l have used is

Workbooks.Open ("BLB0000")

The online help states that the above code will NOT initiate the AutoOpen
macro but that does not seem to be the case !

I am developing the code in Excel 2000 but it will be also need to be used
on Excel 97.

Any help greatly appreciated.

Michael Beckinsale.



Bernie Deitrick[_2_]

Disable AutoOpen macro's
 
Michael,

Use:

Application.EnableEvents = False
Workbooks.Open FileName:="BLB0000"
Application.EnableEvents = True

HTH,
Bernie


"Michael Beckinsale" wrote in
message ...
Hi All,

I have a macro that l run from a workbook which requires a second

workbook
to be opened.

The second workbook contains a AutoOpen macro, the code of which is

in the
ThisWorbook object. The AutoOpen macro prompts the user for Yes/No

answers
upon opening via message boxes.

I would like to disable the AutoOpen macro on the second workbook

when it is
opened via the VBA code in the 1st workbook.

The code l have used is

Workbooks.Open ("BLB0000")

The online help states that the above code will NOT initiate the

AutoOpen
macro but that does not seem to be the case !

I am developing the code in Excel 2000 but it will be also need to

be used
on Excel 97.

Any help greatly appreciated.

Michael Beckinsale.






All times are GMT +1. The time now is 08:59 AM.

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