Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Sequential Sub Procedures

I have a Sub procedure which pulls data into multiple Excel 97 worksheets
from an Access database via MS Query. The data is refreshed with the
command "ActiveWorkbook.RefreshAll".

I then have another Sub procedure to change row height on all the worksheets
to fit the newly imported data.

My problem is that the row height Sub runs before the RefreshAll command has
finished and so none of the rows are changed to match the new data.

Could anyone suggest how I can make the row height procedure run only when
the RefreshAll command has completed.

TIA

Roger


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Sequential Sub Procedures

Hi
Try putting
DoEvents
after the refresh.

Alternatively, is your Row Height sub activated by an Event procedure
(like sheet change or something)? If it is, the Refresh might be
triggering it. To stop that, put Application.EnableEvents = False at
the top and Application.EnableEvents = True at the bottom of your
refresh code.

regards
Paul

"Roger" wrote in message ...
I have a Sub procedure which pulls data into multiple Excel 97 worksheets
from an Access database via MS Query. The data is refreshed with the
command "ActiveWorkbook.RefreshAll".

I then have another Sub procedure to change row height on all the worksheets
to fit the newly imported data.

My problem is that the row height Sub runs before the RefreshAll command has
finished and so none of the rows are changed to match the new data.

Could anyone suggest how I can make the row height procedure run only when
the RefreshAll command has completed.

TIA

Roger

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Sequential Sub Procedures

Each query definition should have a backgroundquery parameter. This is
obviously set to True. You need to set it to false and your macro will wait
for the query to complete.

You could change it with this macro

for each sh in ActiveWorkbook.Worksheets
for each qt in sh.QueryTables
qt.BackgroundQuery = False
next
Next

--
Regards,
Tom Ogilvy



"Roger" wrote in message
...
I have a Sub procedure which pulls data into multiple Excel 97 worksheets
from an Access database via MS Query. The data is refreshed with the
command "ActiveWorkbook.RefreshAll".

I then have another Sub procedure to change row height on all the

worksheets
to fit the newly imported data.

My problem is that the row height Sub runs before the RefreshAll command

has
finished and so none of the rows are changed to match the new data.

Could anyone suggest how I can make the row height procedure run only when
the RefreshAll command has completed.

TIA

Roger




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Sequential Sub Procedures

"Tom Ogilvy" wrote in message
...
Each query definition should have a backgroundquery parameter. This is
obviously set to True. You need to set it to false and your macro will

wait
for the query to complete.

You could change it with this macro

for each sh in ActiveWorkbook.Worksheets
for each qt in sh.QueryTables
qt.BackgroundQuery = False
next
Next


Many thanks for the info Gents - got it running perfectly now.

Cheers,

Roger


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
Separating sub procedures JAW Excel Discussion (Misc queries) 4 January 28th 09 12:17 PM
Non-sequential VLOOKUP function -OR- sequential sort of web query Eric S Excel Worksheet Functions 1 February 28th 05 07:50 PM
Sequential names on Sequential pages Salt4 Excel Worksheet Functions 2 November 12th 04 04:24 PM
VBA -- procedures as arguments? Dave Ring Excel Programming 1 August 27th 03 02:27 AM
Splitting Procedures Markus Excel Programming 4 August 26th 03 05:47 PM


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