ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   wait before executing rest of a macro (https://www.excelbanter.com/excel-programming/415847-wait-before-executing-rest-macro.html)

Luc[_3_]

wait before executing rest of a macro
 
how can you have a macro wait until a external connections have been updated
before contunueing?

practically, the macro has to wait until the following code has been
finished before continueing.

ActiveWorkbook.RefreshAll

Tried Application.Wait (Now + TimeValue("0:00:15")) but this stops
everything, even the refresh.

Héctor Miguel

wait before executing rest of a macro
 
hi, Luc !

how can you have a macro wait until a external connections have been updated before contunueing?
practically, the macro has to wait until the following code has been finished before continueing.

ActiveWorkbook.RefreshAll

Tried Application.Wait (Now + TimeValue("0:00:15")) but this stops everything, even the refresh.


if 15 seconds are enought wait-time for the rest of your procedure... try using two macros (i.e.)

Sub Macro1()
ActiveWorkbook.RefreshAll
Application.OnTime Now + TimeValue("0:00:15"), "macro2"
End Sub

Sub Macro2()
' here the rest of your procedure... '
End Sub

hth,
hector.




All times are GMT +1. The time now is 02:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com