MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Private Sub Workbook_Open

Posted by Steve on January 15, 2002 1:38 AM

I have a suite of Excel 97 spreadsheets which make extensive use of VBA programs. Several have Workbook_Open macros, but these usually don't run if the file is opened by a macro from another workbook.

Is there a way to ensure they do?

Posted by Tom Urtis on January 15, 2002 3:15 AM

Please explain what you mean by "usually". There may be code in the source workbook which suppresses certain Excel actions that another workbook's open event calls for, perhaps based on time or user ID or some global condition. It'd help if we saw the code from both workbooks to make an assessment.

Tom Urtis

Posted by Bariloche on January 15, 2002 5:28 AM

Use Application.Run


In order to execute the Workbook_Open subroutine when opening the workbook using VBA, I believe you need to use the Run method of the Application object:

Workbook.Open "SomeOtherWorkbook"
Application.Run "SomeOtherWorkbook.xls!Workbook_Open"

You might have to check the syntax, but that should get you to where you want to be.