I have some procedures which should be executed with up to date data when opening a certain workbook. I've found out however, that the external data sources get updated only after the workbook open event took place. How can I change that? Or what could I do in order that these procedures get automatically run only after the external data sources have been updated?
Asked
Active
Viewed 801 times
1 Answers
1
You open your workbook and the Workbook_Open() Event fires up. For example,
Private Sub Workbook_Open()
MyMacro
'Call MyMacro
'Run "MyMacro"
End Sub
Sub MyMacro()
MsgBox "This macro fires at Workbook_Open Event", vbInformation, "Info"
End Sub
This shows a message box with the string This macro fires...
.
Let's for now think of it as the macro that updates your records. Now, the records are being updated and you want to refresh your workbook.
You hit ALT + F8
or navigate to a View Macros
window and find MyMacro
macro and run it!
-
Sorry I guess my question was a bit unclear. I know how to use the workbook open Event and placed my macro call there. This macro merges some data from a lot of Sheets. These Sheets contain data from external data sources which are placed in other excel sheets. This update and the merge works great. But the order is wrong. The update of the external worksheets happens AFTER the workbook open. But I want them to happen before the Workbook Open. So what can I do? Is there another Event that gets fired after the update or what? – MichiZH May 29 '13 at 09:39
-
-
[its easy - click here](http://stackoverflow.com/questions/10232150/run-excel-macro-from-outside-excel-using-vbscript-from-command-line) – May 29 '13 at 10:15