#1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 26
Default refresh macro

Windows XP
Office 2003

I have written a simple macro that refreshes all my external data (database
queries) in my spreadsheet. This macro is supposed to refresh everything.
Most of the time this is the case. Sometimes for some reason a dataset or two
that should get refreshed does not get refreshed. If one or two has not
updated after the macro runs, I can manually tell it to refresh and it will
work. Anyone have any idea why the refresh all macro sometimes skips a data
set and/or how to correct it? Is there some sort of a timeout or something
that might be causing this?

Here is my macro:
Sub Macro3()

Application.DisplayAlerts = False

Sheets("Sheet1").Select
Range("A1").Select
ActiveWorkbook.RefreshAll
Application.DisplayAlerts = True
MsgBox("Refresh Complete")

End Sub

Thanks,
-Lou Sanderson
  #2   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6,953
Default refresh macro

Each query should be set so it does not perform a backgroundquery. then no
queries wil be "skipped".

--
Regards,
Tom Ogilvy


"Lou Sanderson" wrote:

Windows XP
Office 2003

I have written a simple macro that refreshes all my external data (database
queries) in my spreadsheet. This macro is supposed to refresh everything.
Most of the time this is the case. Sometimes for some reason a dataset or two
that should get refreshed does not get refreshed. If one or two has not
updated after the macro runs, I can manually tell it to refresh and it will
work. Anyone have any idea why the refresh all macro sometimes skips a data
set and/or how to correct it? Is there some sort of a timeout or something
that might be causing this?

Here is my macro:
Sub Macro3()

Application.DisplayAlerts = False

Sheets("Sheet1").Select
Range("A1").Select
ActiveWorkbook.RefreshAll
Application.DisplayAlerts = True
MsgBox("Refresh Complete")

End Sub

Thanks,
-Lou Sanderson

  #3   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default refresh macro

Saved from a Tom Ogilvy post:

Your problem is your backgroundquery option for your queries. Set these to
false and your code will wait for the query update to finish.

If you don't want to change that parameter in the query itself you can
override it with the refresh command (but not the refresh all command)

Activesheet.queryTables(1).Refresh Backgroundquery:=false

as an example.



Lou Sanderson wrote:

Windows XP
Office 2003

I have written a simple macro that refreshes all my external data (database
queries) in my spreadsheet. This macro is supposed to refresh everything.
Most of the time this is the case. Sometimes for some reason a dataset or two
that should get refreshed does not get refreshed. If one or two has not
updated after the macro runs, I can manually tell it to refresh and it will
work. Anyone have any idea why the refresh all macro sometimes skips a data
set and/or how to correct it? Is there some sort of a timeout or something
that might be causing this?

Here is my macro:
Sub Macro3()

Application.DisplayAlerts = False

Sheets("Sheet1").Select
Range("A1").Select
ActiveWorkbook.RefreshAll
Application.DisplayAlerts = True
MsgBox("Refresh Complete")

End Sub

Thanks,
-Lou Sanderson


--

Dave Peterson
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
how do I email amacro? leo Excel Worksheet Functions 24 August 9th 06 02:47 PM
link to combobox legepe Excel Discussion (Misc queries) 4 July 26th 06 04:45 PM
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Editing a simple macro Connie Martin Excel Worksheet Functions 5 November 29th 05 09:19 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM


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