need vb procedure/function

How can I write a procedure that will check whether a user is connected to/ or can access a remote file share and if not pop up an alert window?
acdagirlAsked:
Who is Participating?
 
lunchbyteConnect With a Mentor Commented:


I am thinking using the dir command.

untested function.


Function check_dir(str As String) As Boolean
       
    On Error GoTo er

    If Dir(str) <> "" Then
        check_dir = True
        ' no problem
    Else
        check_dir = False
        ' have access but found no dir
    End If


er:
    MsgBox "Say something here that they are not connected", vbCritical
End Function
0
 
acdagirlAuthor Commented:
i can use try/catch right? I'd rather not use goto statements...
0
 
lunchbyteCommented:
You must be using vb.net. This is for vb6 the old stuff.

But yes, you can replace the gosub with try/catch.

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/
0
 
acdagirlAuthor Commented:
no, I'm trying to use a macro in a word doc... so I guess try/catch doesn't work for vb6... ok. :-)
0
All Courses

From novice to tech pro — start learning today.