Solved

need vb procedure/function

Posted on 2006-10-24
4
192 Views
Last Modified: 2011-09-20
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
Comment
Question by:acdagirl
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
lunchbyte earned 500 total points
ID: 17796453


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
 

Author Comment

by:acdagirl
ID: 17797122
i can use try/catch right? I'd rather not use goto statements...
0
 
LVL 5

Expert Comment

by:lunchbyte
ID: 17797137
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
 

Author Comment

by:acdagirl
ID: 17797149
no, I'm trying to use a macro in a word doc... so I guess try/catch doesn't work for vb6... ok. :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now