Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Wait until MSQuery Refresh finished

I have a simple excel file that uses MSQuery to pull data from an Oracle DB.
I have a 1 line macro tied to a button so that the user can open the file
and click to refresh (line is just activeworkbook.refreshall).

I want to add a second line of code to save a copy of the file after the
refresh is completed. Code would be..

ActiveWorkbook.SaveCopyAs ("N:\Common\Resale Pricing Team\BE_CR.xls")

The code works, however it saves before the refresh is completed so the data
is not finished pulling into the sheet. Is there a way to have the macro
wait until it determines that the MSQuery is finished refreshing before it
does the SaveCopyAs code? Would rather not do a hard coded Application.Wait
command for x seconds because I don't know how quickly the query will
finished each time it is refreshed (depends on how much data is coming
back). Any thoughts would be greatly appreciated.

c-


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Wait until MSQuery Refresh finished

See response to post "Help! Query Refreshing" also from today in this newsgroup
--
- K Dales


"ChrisR" wrote:

I have a simple excel file that uses MSQuery to pull data from an Oracle DB.
I have a 1 line macro tied to a button so that the user can open the file
and click to refresh (line is just activeworkbook.refreshall).

I want to add a second line of code to save a copy of the file after the
refresh is completed. Code would be..

ActiveWorkbook.SaveCopyAs ("N:\Common\Resale Pricing Team\BE_CR.xls")

The code works, however it saves before the refresh is completed so the data
is not finished pulling into the sheet. Is there a way to have the macro
wait until it determines that the MSQuery is finished refreshing before it
does the SaveCopyAs code? Would rather not do a hard coded Application.Wait
command for x seconds because I don't know how quickly the query will
finished each time it is refreshed (depends on how much data is coming
back). Any thoughts would be greatly appreciated.

c-



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
sendkeys(keys,wait) how do I use wait MM Excel Discussion (Misc queries) 1 February 11th 09 03:47 PM
Please Help: Macro Nearly Finished Dave Excel Discussion (Misc queries) 1 September 20th 07 12:16 PM
Refresh MSQuery w/ Access datasource issue Chris B Excel Discussion (Misc queries) 1 June 29th 06 08:46 PM
Wait for Pivot Refresh to Complete Dan Excel Programming 1 June 14th 05 06:14 PM
Wait for Pivot Refresh before continuing Code Execution Dan Excel Programming 0 May 11th 05 06:12 PM


All times are GMT +1. The time now is 09:02 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"