Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
sot sot is offline
external usenet poster
 
Posts: 19
Default Excel Macro Problem

Basically I've tried to create a macro that opens up all the files in one of
my folders and refreshes the querys in them which bring though new data from
Access. But Excel is determined to try rushing through the steps and
save/close the files before the refresh/calc has finished! Is there a way
around this. See below for current Macro.

Workbooks.Open Filename:= _
"S:\Planning\DP\AW2010 Planning\B+M Tierings\Latest View\AW10
Tiering.xls"
ActiveWorkbook.RefreshAll
ActiveWorkbook.Save
ActiveWindow.Close

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Excel Macro Problem

I've not done what you are asking before, so this is only a guess. Try
putting a DoEvents statement immediately after the RefreshAll line...

Workbooks.Open Filename:= _
"S:\Planning\DP\AW2010 Planning\B+M Tierings\Latest View\AW10
Tiering.xls"
ActiveWorkbook.RefreshAll
DoEvents
ActiveWorkbook.Save
ActiveWindow.Close

--
Rick (MVP - Excel)



"sot" wrote in message
...
Basically I've tried to create a macro that opens up all the files in one
of
my folders and refreshes the querys in them which bring though new data
from
Access. But Excel is determined to try rushing through the steps and
save/close the files before the refresh/calc has finished! Is there a way
around this. See below for current Macro.

Workbooks.Open Filename:= _
"S:\Planning\DP\AW2010 Planning\B+M Tierings\Latest View\AW10
Tiering.xls"
ActiveWorkbook.RefreshAll
ActiveWorkbook.Save
ActiveWindow.Close

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Excel Macro Problem

You might need to turn off background query refreshes if they are turned on.
That will force Excel to complete each query refresh before doing anything
else. Bring up the connection properties dialog for each query, and uncheck
the "Enable background refresh" check box. Or whip up a quick macro that
will do it for all queries in the workbook.

HTH,

Eric



"sot" wrote:

Basically I've tried to create a macro that opens up all the files in one of
my folders and refreshes the querys in them which bring though new data from
Access. But Excel is determined to try rushing through the steps and
save/close the files before the refresh/calc has finished! Is there a way
around this. See below for current Macro.

Workbooks.Open Filename:= _
"S:\Planning\DP\AW2010 Planning\B+M Tierings\Latest View\AW10
Tiering.xls"
ActiveWorkbook.RefreshAll
ActiveWorkbook.Save
ActiveWindow.Close

Reply
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
EXCEL Macro problem amitexcel Excel Programming 10 April 15th 10 01:54 AM
excel macro problem Tomer[_3_] Excel Programming 5 January 14th 08 04:59 AM
Excel-Macro Problem SR Excel Discussion (Misc queries) 8 July 20th 07 06:32 AM
Excel 2k3 Macro Problem Mike Excel Programming 0 September 20th 04 07:29 PM
Excel XP macro problem Paul Reeve Excel Programming 1 November 10th 03 11:26 PM


All times are GMT +1. The time now is 07:26 PM.

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

About Us

"It's about Microsoft Excel"