Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Member
 
Posts: 54
Default How do I pause a macro?

I have a spreadsheet that has links to outside sources. I have a macro that formats the sheet based on the info retrieved. When I try a refresh all then format. It formats before the new data is received. It might take 5 seconds or it might take 2 minutes to refresh. Is there a way to pause a macro until the refresh is complete?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default How do I pause a macro?

hi
sounds like you have background refresh enabled.
i'm assuming that you are using microsoft query and that you are running a
macro to refresh.
1. Right click the query, click properties. uncheck "enable baground refresh"
2. and this line to the macro
Selection.QueryTable.Refresh BackgroundQuery:=False

this way MSQ wil retrieve all data before the macro starts formating.

Regards
FSt1
"Dave H" wrote:


I have a spreadsheet that has links to outside sources. I have a macro
that formats the sheet based on the info retrieved. When I try a
refresh all then format. It formats before the new data is received.
It might take 5 seconds or it might take 2 minutes to refresh. Is
there a way to pause a macro until the refresh is complete?




--
Dave H

  #3   Report Post  
Member
 
Posts: 54
Default

I am using microsoft query. I have several queries. I changed the properties and added the line you suggested but now I am getting a run time error 1008. Application-defined or object defined error. Where should this line be placed in my macro? Thanks for your help.

Quote:
Originally Posted by FSt1 View Post
hi
sounds like you have background refresh enabled.
i'm assuming that you are using microsoft query and that you are running a
macro to refresh.
1. Right click the query, click properties. uncheck "enable baground refresh"
2. and this line to the macro
Selection.QueryTable.Refresh BackgroundQuery:=False

this way MSQ wil retrieve all data before the macro starts formating.

Regards
FSt1
"Dave H" wrote:


I have a spreadsheet that has links to outside sources. I have a macro
that formats the sheet based on the info retrieved. When I try a
refresh all then format. It formats before the new data is received.
It might take 5 seconds or it might take 2 minutes to refresh. Is
there a way to pause a macro until the refresh is complete?




--
Dave H
  #4   Report Post  
Member
 
Posts: 54
Default

Quote:
Originally Posted by Dave H View Post
I am using microsoft query. I have several queries. I changed the properties and added the line you suggested but now I am getting a run time error 1008. Application-defined or object defined error. Where should this line be placed in my macro? Thanks for your help.
Just by changing the query properties to not enable background refresh solved the problem without adding any lines to the macro.

Thanks for your help.
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default How do I pause a macro?



"Dave H" wrote:


I have a spreadsheet that has links to outside sources. I have a macro
that formats the sheet based on the info retrieved. When I try a
refresh all then format. It formats before the new data is received.
It might take 5 seconds or it might take 2 minutes to refresh. Is
there a way to pause a macro until the refresh is complete?




--
Dave H



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default How do I pause a macro?--VERY EASY

I HAVE SEVERAL FRIENDS THAT MAKE MACRO PROGRAMS USED ON INLINE POKER
GAMING--VERY SIMPLE TO PAUSE IT--JUST CLICK PAUSE BUTTON ON UPPER RIGHT HAND
OF YOUR KEYBOARD--ALSO TRY F12-- OR F13 BUTTONS--USUALLY A PROGRAMMER WILL
USE A F# TO START THE MACRO AND/OR TO STOP IT--GL--ANYTHING ELSE ABOUT
MACROS, JUST GIVE ME A

"Dave H" wrote:


I have a spreadsheet that has links to outside sources. I have a macro
that formats the sheet based on the info retrieved. When I try a
refresh all then format. It formats before the new data is received.
It might take 5 seconds or it might take 2 minutes to refresh. Is
there a way to pause a macro until the refresh is complete?




--
Dave H

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
Pause Macro 2 Ollie Excel Discussion (Misc queries) 3 June 15th 06 04:49 AM
Pause Excel Macro Ollie Excel Discussion (Misc queries) 3 June 14th 06 06:59 AM
Forcing a macro to pause for filename matpoh Excel Discussion (Misc queries) 3 September 13th 05 06:28 PM
How do I pause a macro to select specific cells lee Excel Worksheet Functions 1 April 2nd 05 02:11 PM
Macro to move to specified cells, pause for input at each? Pete in Montrose Excel Discussion (Misc queries) 1 March 5th 05 06:18 PM


All times are GMT +1. The time now is 01:06 PM.

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

About Us

"It's about Microsoft Excel"