MrExcel Publishing
Your One Stop for Excel Tips & Solutions

running a macro when a wrbk opens


Posted by amroo on June 29, 2001 2:57 AM

Bonjour, how do I code to run a macro when I open a wrkb by an other macro.
Thanks
A+mroo


Posted by Dax on June 29, 2001 5:16 PM

You have to use the RunAutomacros method. For example, if your other workbook is called Book2 and is on the C drive then use this:-

sub RunMacs()
dim WB as Workbook
set WB=Workbooks.Open "C:\Book2.xls"
WB.RunAutomacros
End Sub

Hope this helps,
Dax.