View Single Post
  #3   Report Post  
Matthew McManus
 
Posts: n/a
Default


Thanks for that JMB.

I have been thinking about a simple way of accomplishing what I want
without getting too far into error numbers and so on. I thought of the
following. Can anyone see any potential problems with the it?
(To re-state: File, x.xls periodically opens y.csv and copies a value
from there. If y.csv is being written to when x.xls tries to access it
(and so is read only), I would like it to try again later or when y.csv
is available. The timing is nor particularly important.)

Line1:
On Error GoTo Line2
Workbooks.Open Filename:= "C:\y.csv"
Range("A1").Select
Selection.Copy
Windows("x.xls").Activate
Range("B1").Select
Activesheet.Paste
Windows("y.csv").Activate
ActiveWorkbook.Close
GoTo Line3
Line2:
Application.Wait Now + TimeValue("00:00:10")
On Error GoTo 0
GoTo Line1
Line3:
Application.Wait Now + TimeValue("00:00:30")
GoTo Line1

Thanks
Mat


--
Matthew McManus
------------------------------------------------------------------------
Matthew McManus's Profile: http://www.excelforum.com/member.php...fo&userid=5833
View this thread: http://www.excelforum.com/showthread...hreadid=375127