wait before executing rest of a macro

L

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.
 
H

Héctor Miguel

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.
 
L

Luc

great help, thanks Hector

Héctor Miguel said:
hi, Luc !


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.
 
H

Héctor Miguel

great help, thanks Hector

thanks for your feed-back, Luc

regards,
hector.

__ OP __
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top