Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default is there a code to wait?

i have Register1.xls and register2.xls on seperate computers and data.xls
register1 & 2 feed into data.xls (shared)
i have macro "submitall" that enters info from the register into data.xls
and saves.

is there a way that if register1 is saving/updating data.xls and register2
tries to save/update...that it will not start "submitall" or that it will
wait until the other register is done saving?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default is there a code to wait?

In data.xls on a convinient sheet and on a convinient cell, Name the cell
as say "Busy",
and in that cell enter "NO" (w/o quotation marks) and save it.
In your code in register1.xls and register2.xls, both,
just before feeding data, you can do as under:
(Assuming the you named cell Busy in Sheet1)

Dim sTime as Long
With Workbooks("data.xls")
With .Worksheets("Sheet1").Range("Busy")
sTime = Timer
Do Until .Value = "NO"
If Timer sTime + 20 Then
MsgBox "Waited for 20 seconds, still data.xls is busy" &
_
Chr(13) & "Giving up now. Try later.",
vbCritical
Exit Sub
End If
DoEvents
Loop
.Value = "YES"
End With

' Here onwards Your rest of the code to feed data
'then the add below line at the last
.Worksheets("Sheet1").Range("Busy").Value = "NO"
End With

Sharad

"choice" wrote in message
...
i have Register1.xls and register2.xls on seperate computers and data.xls
register1 & 2 feed into data.xls (shared)
i have macro "submitall" that enters info from the register into data.xls
and saves.

is there a way that if register1 is saving/updating data.xls and register2
tries to save/update...that it will not start "submitall" or that it will
wait until the other register is done saving?



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
sendkeys(keys,wait) how do I use wait MM Excel Discussion (Misc queries) 1 February 11th 09 03:47 PM
wait for user action in VBA code benb Excel Programming 4 September 24th 04 09:05 PM
VBA Code to wait 50-150 mS Hotbird[_2_] Excel Programming 2 December 31st 03 09:15 PM
wait Eddie[_4_] Excel Programming 3 November 15th 03 03:37 PM
Excel code to Wait until Word finishes printing before closing Mike Molyneaux[_2_] Excel Programming 2 October 24th 03 02:45 AM


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