ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro ignors module code (https://www.excelbanter.com/excel-programming/274014-re-macro-ignors-module-code.html)

Chip Pearson

Macro ignors module code
 
Phil,

The Auto_Open macro is not executed when a file is opened via VBA.
You can call the RunAutoMacros method to execute the Auto_Open
procedures.


Workbooks("Housing BSC for 2004.xls").RunAutoMacros xlAutoOpen


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Phil Hageman" wrote in message
...
I have the following macro code in the Personal.xls
workbook to open a workbook:

Sub OpenBSC()
Workbooks.Open ("W:\Housing\Housing BSC for 2004.xls")
End Sub

However, the sub ignores an AutoOpen() sub in the target
workbook's Module1. How do I make the macro run the
Module1 AutoOpen() in the target workbook?

Thanks, Phil




Phil Hageman

Macro ignors module code
 
Chip, the RunAuto... did the trick. Thanks
-----Original Message-----
Phil,

The Auto_Open macro is not executed when a file is opened

via VBA.
You can call the RunAutoMacros method to execute the

Auto_Open
procedures.


Workbooks("Housing BSC for 2004.xls").RunAutoMacros

xlAutoOpen


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Phil Hageman" wrote in message
...
I have the following macro code in the Personal.xls
workbook to open a workbook:

Sub OpenBSC()
Workbooks.Open ("W:\Housing\Housing BSC for 2004.xls")
End Sub

However, the sub ignores an AutoOpen() sub in the target
workbook's Module1. How do I make the macro run the
Module1 AutoOpen() in the target workbook?

Thanks, Phil



.



All times are GMT +1. The time now is 12:06 AM.

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