ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Timer function (https://www.excelbanter.com/excel-programming/272487-re-timer-function.html)

Bob Phillips[_5_]

Timer function
 
Use Wait.

This example waits 10 seconds

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"L Buchy" wrote in message
...
I am using the Timer function in the BeforeClose event to try & pause
application before saving file & exiting. I need to do this as I am

running
Excel via a VBScript & spreadsheet has DDE links & it needs a second or

two
for it to update the links. Whats happening is it saves the file & exits
too quick and my links are not updated in the saved file.

My code in the BeforeClose event is as follows (as found in help):

Start = Timer
Do While Timer < Start + 5
DoEvents
Loop

This doesn't seem to work. How can I pause or delay Excel before I
close/save the file?






All times are GMT +1. The time now is 07:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com