简体   繁体   中英

Refresh data sources and workbook_open event

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?

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM