View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Is workbook open on the network?

Ian,

This function will test it, but it does open it to find out

Function IsNetworkOpen(filename As String)
Dim nFile As Long

IsNetworkOpen = False

nFile = FreeFile()
On Error Resume Next
Open filename For Input Lock Read Write As #nFile
If Err < 0 Then
If Err.Number = 70 Then
IsNetworkOpen = True
Else
IsNetworkOpen = "No such file"
End If
End If
On Error GoTo 0
Close #nFile

End Function



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ianripping " wrote in message
...
Yes, but instead of that message appearing, I want it to just not open
then workbook.


---
Message posted from http://www.ExcelForum.com/