ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto_open not executing (https://www.excelbanter.com/excel-programming/340345-auto_open-not-executing.html)

Lon Sarnoff

Auto_open not executing
 
I have created an Auto_Open sub which does properly execute if the workbook
is opened via Windows. But if the same workbook is opened via a VBA
statement from within another workbook, the Auto_Open does not execute even
though the workbook in fact is opened.

Any suggestions?
--
Lon Sarnoff

Norman Jones

Auto_open not executing
 
Hi Lon,

See VBA help on the RunAutoMacros method.

The following worked for me:

Sub aMacro()
Workbooks.Open "MyTest.xls"
ActiveWorkbook.RunAutoMacros xlAutoOpen
End Sub

---
Regards,
Norman



"Lon Sarnoff" wrote in message
...
I have created an Auto_Open sub which does properly execute if the workbook
is opened via Windows. But if the same workbook is opened via a VBA
statement from within another workbook, the Auto_Open does not execute
even
though the workbook in fact is opened.

Any suggestions?
--
Lon Sarnoff




Dave Peterson

Auto_open not executing
 
Take a look at .runautomacros in VBA's help. (You have to run that other
auto_open sub yourself.)

Lon Sarnoff wrote:

I have created an Auto_Open sub which does properly execute if the workbook
is opened via Windows. But if the same workbook is opened via a VBA
statement from within another workbook, the Auto_Open does not execute even
though the workbook in fact is opened.

Any suggestions?
--
Lon Sarnoff


--

Dave Peterson

Lon Sarnoff

Auto_open not executing
 
The activeworkbook line solved the problem. Thank you.
--
Lon Sarnoff


"Norman Jones" wrote:

Hi Lon,

See VBA help on the RunAutoMacros method.

The following worked for me:

Sub aMacro()
Workbooks.Open "MyTest.xls"
ActiveWorkbook.RunAutoMacros xlAutoOpen
End Sub

---
Regards,
Norman



"Lon Sarnoff" wrote in message
...
I have created an Auto_Open sub which does properly execute if the workbook
is opened via Windows. But if the same workbook is opened via a VBA
statement from within another workbook, the Auto_Open does not execute
even
though the workbook in fact is opened.

Any suggestions?
--
Lon Sarnoff






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

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