Solved

need vb procedure/function

Posted on 2006-10-24
4
195 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run code from text file in vb 1 84
Copy a row 12 69
Looking for VB6 code to read SQL table export it to ascii 8 47
Powerpoint 2013: Change cell reference in excel link 3 119
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

679 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