Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Jim, I immediately start testing, I'll post the result.
Stefi €˛Jim Cone€¯ ezt Ć*rta: 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Please do. --- Jim Cone "Stefi" wrote in message Thanks Jim, I immediately start testing, I'll post the result. Stefi |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Stefi" wrote:
Thanks Jim, I immediately start testing, I'll post the result. Stefi €˛Jim Cone€¯ ezt Ć*rta: I am not on a network to test it, but the FileSystemObject should be able to do it... Is there any way to detect the accessibility of the server before using DIR? You can also use ping command to check if your server is accesible. Here is some sample code from Richard Mueller's site: http://www.rlmueller.net/Programs/Ping2.txt -- urkec |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Chart accessibility in a shared workbook | Charts and Charting in Excel | |||
Accessibility to macros | Excel Programming | |||
Password/worksheet-accessibility | Excel Discussion (Misc queries) | |||
Accessibility of Custom Functions | Excel Programming | |||
Section 508 accessibility and Excel | Excel Programming |