View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default checking file already open status

here's one from bob phillips

Dim oWB As Workbook

On Error Resume Next
Set oWB = Workbooks("myBook")
On Error GoTo 0
If oWB Is Nothing Then
Set oWB = Workbooks.Open("C:\myDir\myBook.xls")
End If
oWB.Worksheets("Sheet1").Activate



--


Gary


"John F. Collins" wrote in message
...
Another user has a tab delimited text file named myFile.xls open on a
server, writing to the file with Labview, and periodically flushing to
disk. While he still has the file open, I open the same file in excel
using
workbooks.open, with ReadOnly:= true. The Labview user tells me this
freezes the file so that he can no longer write to it.

How can I avoid having Excel open for exclusive use, even though it is
read
only, and already open by someone else?

If I can't do that, then how can I check the status of the file to make
sure
that no one has it open before I try to open it?

John