LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Making macros Wait

Hi

I am trying to write a macro that will automate a series of similar
tasks. In each task I have to wait for a report to finish calculating
before saving the output file and then going on to the next task.

The reports are processed using the Jet Reports add-in and I am facing
problems in making the macro wait for about 10 minutes till the report
processing is completed and the output file saved. I have tried the
following without success:

(1)

For(from report 1 to 5)
---
----
Application.OnTime Now + TimeValue("00:10:00"), SrcFlPath + DataFlName
+ "!Module1.SaveFile"
Next report

When Excel encounters this statement, I think it starts a timer but the
control goes to the next statement in my loop and begins to process the
next report. However, the next task should not begin until the earlier
task is completed.

(2) So the next method I tried was to make the macro "Sleep". Although
this makes the macro wait for 10 minutes before saving and proceeding
to the next task, it interferes with the report processing! As a result
the output files saved don't have the processed results.

For(from report 1 to 5)
---
----
'Setting the Timer 10 minutes in seconds
Timer = 600
Do While Timer 0
' Macro sleeps for 1 second
Sleep 1000
Timer = Timer - 1
Loop
SaveFile()
Next report

Any tips to solve this problem? Thanks in advance for your help.

Aswini

 
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
sendkeys(keys,wait) how do I use wait MM Excel Discussion (Misc queries) 1 February 11th 09 03:47 PM
Making Macros Available in All Workbooks QUESTION-MARK Excel Worksheet Functions 2 May 23rd 06 01:47 PM
Making Macros in Excel mike b Excel Programming 3 April 2nd 05 01:52 PM
Looking for help with macros and chart making. mike drav Excel Programming 2 January 26th 05 06:04 PM
Making excel macros run Word macros Matthew McManus Excel Programming 1 February 18th 04 02:57 AM


All times are GMT +1. The time now is 03:43 AM.

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"