Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Accessibility of a server

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Accessibility of a server


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Accessibility of a server

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Accessibility of a server


Please do.
---
Jim Cone



"Stefi"

wrote in message
Thanks Jim, I immediately start testing, I'll post the result.
Stefi



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Accessibility of a server

"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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart accessibility in a shared workbook Libby Charts and Charting in Excel 2 May 10th 08 01:38 PM
Accessibility to macros Richard Excel Programming 3 April 25th 06 11:54 PM
Password/worksheet-accessibility tmack2511 Excel Discussion (Misc queries) 7 January 3rd 06 05:55 PM
Accessibility of Custom Functions jwa76 Excel Programming 2 December 18th 03 01:44 PM
Section 508 accessibility and Excel Kathy[_8_] Excel Programming 0 December 9th 03 01:26 AM


All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"