Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default macro to refresh from Access and then

I have a spreadsheet that is linked to an Access query. I am opening this
spreadsheet with a macro. In the macro, I am executing a refresh command and
then I need to do some other things with the macro (such as opening other
files and grabbing certain cells and putting them in a new spreadsheet). It
seems that sometimes the macro continues without the refresh having
completed. Is there a way to ensure the macro does not continue until the
refresh has finished?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default macro to refresh from Access and then

hi
you are allowing the query to refresh in the background. not recomended for
reason you have already found out.
would have been nice if you had posted your refresh code but here is the
line i use to refresh
Sheets("sheet1").range("A1").querytable.refresh backgroundquery:=false
adjust the sheet and cell references to suit.
you could also use..
sheets("sheet1").select
range("A1").select
selection.querytable.refresh Backgroundquery:=False
but why????
either way will pause code execution untill the refresh is complete.

Regards
FSt1

"klav" wrote:

I have a spreadsheet that is linked to an Access query. I am opening this
spreadsheet with a macro. In the macro, I am executing a refresh command and
then I need to do some other things with the macro (such as opening other
files and grabbing certain cells and putting them in a new spreadsheet). It
seems that sometimes the macro continues without the refresh having
completed. Is there a way to ensure the macro does not continue until the
refresh has finished?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default macro to refresh from Access and then

Thank you for your help.

"FSt1" wrote:

hi
you are allowing the query to refresh in the background. not recomended for
reason you have already found out.
would have been nice if you had posted your refresh code but here is the
line i use to refresh
Sheets("sheet1").range("A1").querytable.refresh backgroundquery:=false
adjust the sheet and cell references to suit.
you could also use..
sheets("sheet1").select
range("A1").select
selection.querytable.refresh Backgroundquery:=False
but why????
either way will pause code execution untill the refresh is complete.

Regards
FSt1

"klav" wrote:

I have a spreadsheet that is linked to an Access query. I am opening this
spreadsheet with a macro. In the macro, I am executing a refresh command and
then I need to do some other things with the macro (such as opening other
files and grabbing certain cells and putting them in a new spreadsheet). It
seems that sometimes the macro continues without the refresh having
completed. Is there a way to ensure the macro does not continue until the
refresh has finished?

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
Refresh from Access not working klav[_2_] Excel Programming 1 February 13th 09 11:31 PM
Macro to Refresh from Access klav[_2_] Excel Programming 0 February 13th 09 07:34 PM
Refresh Data if Access File has Password Mike H. Excel Programming 0 October 19th 07 12:33 PM
Timing of automatic query refresh and macro pivot table refresh dutty Excel Programming 2 December 1st 04 07:19 PM
Web Query Logins and Access Refresh [email protected] Excel Programming 3 April 12th 04 10:46 PM


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