• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

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?
0
acdagirl
Asked:
acdagirl
  • 2
  • 2
1 Solution
 
lunchbyteCommented:


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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now