![]() |
how do i get the "RefreshAll" method to work in a macro
i can get it to work when i step through my macro, but not when i run the
whole macro. i've even tried to put a "wait" into the macro, but it waits with "connecing to data source" in bottom left corner. |
how do i get the "RefreshAll" method to work in a macro
On Aug 2, 2:16 pm, sloan wrote:
i can get it to work when i step through my macro, but not when i run the whole macro. i've even tried to put a "wait" into the macro, but it waits with "connecing to data source" in bottom left corner. What's the VB code you are using and where is it placed? |
how do i get the "RefreshAll" method to work in a macro
On Aug 2, 2:27 pm, KLZA wrote:
On Aug 2, 2:16 pm, sloan wrote: i can get it to work when i step through my macro, but not when i run the whole macro. i've even tried to put a "wait" into the macro, but it waits with "connecing to data source" in bottom left corner. What's the VB code you are using and where is it placed? You can try this macro in your ThisWorkbook object.. Private Sub Workbook_Open() me.RefreshAll End Sub Or you can create a macro named Auto_Open with the following code.. Sub Auto_Open() ActiveWorkbook.RefreshAll End Sub Included wait... Sub Auto_Open() newHour = Hour(Now()) newMinute = Minute(Now()) newSecond = Second(Now()) + 10 'waits 10 seconds waitTime = TimeSerial(newHour, newMinute, newSecond) Application.Wait waitTime ActiveWorkbook.RefreshAll MsgBox "Refreshed!" End Sub |
how do i get the "RefreshAll" method to work in a macro
Make sure all your queries are configured to NOT do background queries. Then
the code should wait for the query to finish before proceeding. -- Regards, Tom Ogilvy "sloan" wrote: i can get it to work when i step through my macro, but not when i run the whole macro. i've even tried to put a "wait" into the macro, but it waits with "connecing to data source" in bottom left corner. |
how do i get the "RefreshAll" method to work in a macro
THX that seems to work.
"KLZA" wrote: On Aug 2, 2:27 pm, KLZA wrote: On Aug 2, 2:16 pm, sloan wrote: i can get it to work when i step through my macro, but not when i run the whole macro. i've even tried to put a "wait" into the macro, but it waits with "connecing to data source" in bottom left corner. What's the VB code you are using and where is it placed? You can try this macro in your ThisWorkbook object.. Private Sub Workbook_Open() me.RefreshAll End Sub Or you can create a macro named Auto_Open with the following code.. Sub Auto_Open() ActiveWorkbook.RefreshAll End Sub Included wait... Sub Auto_Open() newHour = Hour(Now()) newMinute = Minute(Now()) newSecond = Second(Now()) + 10 'waits 10 seconds waitTime = TimeSerial(newHour, newMinute, newSecond) Application.Wait waitTime ActiveWorkbook.RefreshAll MsgBox "Refreshed!" End Sub |
All times are GMT +1. The time now is 04:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com