I am not on a network to test it, but the FileSystemObject should be able to do it...
'--
Sub ProvidePath()
Dim strPath As String
strPath = "FillInPathToTheFileOnTheServer" '<<<<<
MsgBox ReportFileStatus(strPath)
End Sub
'--
Function ReportFileStatus(ByRef fileSpec As String) as String
Dim fso As Object
Dim msg As String
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(fileSpec)) Then
msg = fileSpec & " exists."
Else
msg = fileSpec & " doesn't exist."
End If
ReportFileStatus = msg
Set fso = Nothing
End Function
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins - check out "List Files" )
"Stefi"
wrote in message
Hi All,
I have to check whether a file exists on a remote server or not. DIR works
when the server is accessible, but doesn't reply if connection is broken and
keeps searching the file ad infinitum, I can't even interrupt running the
macro (neither with Esc nor with Task manager).
Is there any way to detect the accessibility of the server before using DIR?
Thanks,
Stefi