I'm trying to perform the below operation from a workbook (Say A.xlsm
):
- Opening another workbook (say
B.xlsb
) - Calling a macro in
B.xlsb
fromA.xlsm
- Save the workbook
B.xlsb
- Close the workbook
B.xlsb
Below is the code in A.xlsm
:
Workbooks.Open(Filename:=B.xlsb).RunAutoMacros Which:=xlAutoOpen
Workbooks(B.xlsb).Activate
Windows(B.xlsb).Activate
Application.Run (B.xlsb& "!MyMacro")
Above all works fine, but a macro (Initialize
, which is for initializing the ribbon object) gets skipped in B.xlsm
which is should get called at the time of loading of the workbook B.xlsb
. When I open it manually and then Save and close.
I see the macros Workbook_Open
, Workbook_Activate
and Initialize
(this is configured in an XML to be called at the loading time) gets called in sequence.
But the same when I do from VBA then Workbook_Open
and Workbook_Activate
are called but Initialize
gets skipped.
B.xlsb
is calling theInitialise
sub? also can you provide the code that actually makes the call to this sub? – Zac