Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wait until Sub1 is finished

Status
Not open for further replies.

goldyr

Programmer
May 26, 2003
25
SE
I have one sub (Refresh-data) in excel that gets data via MS-query and the second sub (Format_Column) formats the column. How can I make sure that the first sub has finished before the second starts?

/Liz
 
And be sure that the BackgroundQuery property of your QueryTable is set to False.

Hope This Help
PH.
 
PHV's advice will work. Skip - even if you have the 2 subs run from a amin sub, the code can still be executing whilst the SQL is running so it could still mess up. Setting background query to false ensures that the code does not continue until after the query has been processed

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top