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: 2
Default VB refresh of query

Okay here is the code used to open a workbook, refresh the query, save the
work book and exit out of it. Problem is that the save script acts prior to
the refresh of the query completing and get an error "This action will cancel
a pending Refresh Data Command." How do I allow all queries to refresh prior
to saving and closing the workbook?

Sub Refresh()
'
' Refresh Macro
' Macro recorded 5/3/2007 by Authorized User
'
' Keyboard Shortcut: Ctrl+Shift+R
'
ChDir "File Location"
Workbooks.Open Filename:= _
"File name"
ActiveWorkbook.RefreshAll
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Control").Select
ActiveWorkbook.Save
ActiveWindow.Close

End Sub
 
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
How can I 'Enable Automatic Refresh' for Query Refresh by default Anand Deshpande Setting up and Configuration of Excel 0 December 10th 06 04:47 AM
Query Refresh-Enable Automatic Refresh Dialogue Box Terri Excel Discussion (Misc queries) 0 May 6th 05 08:21 PM
Timing of automatic query refresh and macro pivot table refresh dutty Excel Programming 2 December 1st 04 07:19 PM
Excel does not close from VB!! (when i refresh Refresh query with BackgroundQuery:=False) Anant[_2_] Excel Programming 1 August 6th 03 04:22 AM
Web Query fail to Refresh All but individual refresh is ok Karyn Mak Excel Programming 2 July 17th 03 09:30 AM


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