Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Refresh to Multiple Files

I want to know if there is a way to set multiple files to open, refresh,
save, and close. I have 38 files that need to refresh when I update my
Access database.

#1 We've set the files to NOT refresh upon opening for control purposes.
Evidently there's been problems with this in the past.
#2 I've already tried a macro but when I run it Excel tries to save before
the refresh is complete.
#3 So basically I want a "go button", something I can kick-off and it will
go through all 38 files and do the refreshes. I know a little SQL and my
co-worker knows a little VBA.

Thanks in advance for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Refresh to Multiple Files

What query? I've already run the queries in my Access database and I just
want to refresh all my Excel files.

"K Dales" wrote:

The querytable (the result range of the query) has a property .Refreshing
that can let you know if the query is still running or is done. So you
should be able to incorporate this into your macro to make sure the query is
done before moving on to save the file.

Assuming you are looping somehow through your files, the code could contain
lines like the ones below:

Dim MyQuery as QueryTable
' Loop through files....
With ThisWorkbook.Sheets("QuerySheet").QueryTables(1)
.Refresh
While .Refreshing
DoEvents
WEnd
' Save and close the workbook, then next file...

One added suggestion: I hate to just leave a loop waiting for some process
to finish (what if I lose the network connection, or something else prevents
the query from finishing...) so I often set an end time as a timeout, then
use it as part of the loop:

Timeout = Now()+Timevalue("00:15:00")
While Refreshing and Now()<=Timeout
...

HTH

"Vanessa" wrote:

I want to know if there is a way to set multiple files to open, refresh,
save, and close. I have 38 files that need to refresh when I update my
Access database.

#1 We've set the files to NOT refresh upon opening for control purposes.
Evidently there's been problems with this in the past.
#2 I've already tried a macro but when I run it Excel tries to save before
the refresh is complete.
#3 So basically I want a "go button", something I can kick-off and it will
go through all 38 files and do the refreshes. I know a little SQL and my
co-worker knows a little VBA.

Thanks in advance for your help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Refresh to Multiple Files

The querytable (the result range of the query) has a property .Refreshing
that can let you know if the query is still running or is done. So you
should be able to incorporate this into your macro to make sure the query is
done before moving on to save the file.

Assuming you are looping somehow through your files, the code could contain
lines like the ones below:

Dim MyQuery as QueryTable
' Loop through files....
With ThisWorkbook.Sheets("QuerySheet").QueryTables(1)
.Refresh
While .Refreshing
DoEvents
WEnd
' Save and close the workbook, then next file...

One added suggestion: I hate to just leave a loop waiting for some process
to finish (what if I lose the network connection, or something else prevents
the query from finishing...) so I often set an end time as a timeout, then
use it as part of the loop:

Timeout = Now()+Timevalue("00:15:00")
While Refreshing and Now()<=Timeout
...

HTH

"Vanessa" wrote:

I want to know if there is a way to set multiple files to open, refresh,
save, and close. I have 38 files that need to refresh when I update my
Access database.

#1 We've set the files to NOT refresh upon opening for control purposes.
Evidently there's been problems with this in the past.
#2 I've already tried a macro but when I run it Excel tries to save before
the refresh is complete.
#3 So basically I want a "go button", something I can kick-off and it will
go through all 38 files and do the refreshes. I know a little SQL and my
co-worker knows a little VBA.

Thanks in advance for your help.

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
Data import from different excel files & automatic refresh Aspa Excel Discussion (Misc queries) 0 April 23rd 08 09:30 AM
Unable to open files after installing Office 2007 refresh !!! rkisling Excel Discussion (Misc queries) 2 October 5th 06 02:43 AM
Refresh multiple pivot tables Latasha at PBG Excel Discussion (Misc queries) 0 May 2nd 06 04:04 PM
view multiple files in multiple windows on multiple screens. tcom Excel Discussion (Misc queries) 7 September 15th 05 09:35 PM
Refresh Multiple Pivot Tables Paul Excel Programming 1 August 18th 04 12:47 PM


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