LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Force Macro to wait till Refreshall is done


Here is my code:

ActiveWorkbook.RefreshAll 'runs query from access and updates in excel
ActiveSheet.Calculate
ActiveWorkbook.Save 'where the macro fails
ActiveWorkbook.Close
-----------------------------

Problem is that the Refreshall does not complete and goes to the nex
command. I get a msg box that pops up writes "This action will cance
a pending Refresh Data Command. Continue?"

So if I say "yes" the data does not refresh but finishes macro but i
say "no" the macro does not finish.

I tried to enter a wait code:

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 30
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

but this does not help. Anyone have any suggestions?

Thanks

--
NCSU_madma
-----------------------------------------------------------------------
NCSU_madman's Profile: http://www.excelforum.com/member.php...fo&userid=1631
View this thread: http://www.excelforum.com/showthread.php?threadid=27702

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wait statement in macro tjfwestcoast Excel Discussion (Misc queries) 1 February 5th 10 08:35 PM
sendkeys(keys,wait) how do I use wait MM Excel Discussion (Misc queries) 1 February 11th 09 03:47 PM
Macro wait 30 seconds then Complete the Macro Vick Excel Discussion (Misc queries) 2 June 2nd 08 08:04 PM
row that needs to wait till the next page break befor copying wil4d Excel Discussion (Misc queries) 0 December 20th 05 02:36 PM
Macro to nsert value from table, then next value, till done Sheryl Lang Excel Programming 1 December 5th 03 10:33 PM


All times are GMT +1. The time now is 12:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"