Solved

need vb procedure/function

Posted on 2006-10-24
4
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
message box in access 4 55
which modules are active in VB6 project? 6 57
Error with a code discussed on this page 5 51
VBA - If Bookmark = "XXBOOKMARKXX" then 15 67
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

751 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