Checking a net drive

How do I check if a mapped drive is available and how do I 
get a return value which can be used for testing the 
avalability.
I psudocode something like:

If netdrive("Compagny-net/allusers") then
bla.. bla
end if

Kind regards
Leif Rasmussen
New in Excel VBA but facinated.
0
anonymous (74722)
1/11/2005 11:42:52 PM
excel.misc 78881 articles. 5 followers. Follow

2 Replies
536 Views

Similar Articles

[PageSpeed] 36

Leif,
    You need a reference to "Microsoft Scripting Runtime" library 
(C:\WINDOWS\SYSTEM32\SCRRUN.DLL).  You can get to it via Tools | References 
in the VBE (Visual Basic Editor).

  It has a lot of great methods.  Look through the object browser once 
you've set the reference.

  In the meantime....

sub test
  Dim fso As Scripting.FileSystemObject
  msgbox fso.Drives("D").IsReady
end sub
 

HTH,
Gary Brown





"Leif Rasmussen" wrote:

> How do I check if a mapped drive is available and how do I 
> get a return value which can be used for testing the 
> avalability.
> I psudocode something like:
> 
> If netdrive("Compagny-net/allusers") then
> bla.. bla
> end if
> 
> Kind regards
> Leif Rasmussen
> New in Excel VBA but facinated.
> 
0
GaryBrown (90)
1/12/2005 12:49:02 AM
Is there a reason you don't want to work with the UNC name?

I know that we use a lot of shares at work and lots of times, the users map them
to different letters (if they're mapped at all).

I do a cheap and dirty test:

Option Explicit
Sub testme()

    Dim myPathFolder As String
    Dim testStr As String
    
    myPathFolder = "\\sharename\folder1\folder2"
    If Right(myPathFolder, 1) <> "\" Then
        myPathFolder = myPathFolder & "\"
    End If
    
    testStr = ""
    On Error Resume Next
    testStr = Dir(myPathFolder & "nul")
    On Error GoTo 0
    
    If testStr = "" Then
        MsgBox "path folder doesn't exist"
    End If
End Sub





Leif Rasmussen wrote:
> 
> How do I check if a mapped drive is available and how do I
> get a return value which can be used for testing the
> avalability.
> I psudocode something like:
> 
> If netdrive("Compagny-net/allusers") then
> bla.. bla
> end if
> 
> Kind regards
> Leif Rasmussen
> New in Excel VBA but facinated.

-- 

Dave Peterson
0
ec357201 (5290)
1/12/2005 1:36:40 AM
Reply:

Similar Artilces:

DVD Drive Icon Not Changing
I hava a copy of the DVD drive icon on my desktop. Even though I have used other DVD's, the Icon for a DVD I used several weeks ago is still there. The same is true for the My Computer (Computer) view. How can I fix this? ...

Need to redownload/install after hard drive crash
My hard drive crashed and I'm in the process of reinstalling/rebuilding everything, however I don't have a saved copy of Money Premium that I purchased. I still have my emailed receipt and can provide proof of purchase. How do I download my registered copy again? Depends on the version, but if you bought the downloaded version of 2005 or 2006 see http://money.mvps.org/faq/article/132.aspx -- Glyn Simpson, Microsoft MVP - Money http://money.mvps.org Check http://money.mvps.org/faq/default.aspx for tips and fixes for MS Money. To send Microsoft your product wishes see http://mo...

How to comp/lnk an interface layer between a .NET 2003 app and VS6
Hi, I am currently trying to get an interface layer working between an app that is written in .NET 2003 as Multithreaded DLL and an SDK that provides a DLL compiled as Multithreaded in VS6. The app is not ours so we can't touch that. It provides a HAL framework, which in essence is the interface layer that needs to be filled in using our SDK. The current problem exposes random access violations and the debugger shows them happening in new or delete's. It behaves differently with release and/or debug mode, but crashes appear in both. We currently use VS6 to build the interface ...

Controlling CD-RW drive via an API?
Can someone point me to a set of CD-RW drivers that I can install with my commercial package that I can control (monitor disk burn status, eject disk, etc.) via my low level routines? Any pointers with REAL experience in a shipping commercial produce is appreciated. Thanks! nero has a published and downloadable api that enables you to integrate the burn process. haven't tried it. Also, look IMAPI (windows XP native CD writing API) and DeviceIoControl API. With the latter you can eject discs. IMAPI is simple - perhaps too simple for you needs. I would expect that if your process di...

Report to Print Checks
How can I determine which report is being used as the one to print our companies checks? We have a top and bottom check format, and there are four top and bottom options. I have tried altering them all, but it does not result in a change in the end product. I have verified that I have set proper access to these particular modified forms and reports. Therefore, I am wanting to see if it is pulling from a report that I am not seeing so that I can get it edited. hi, print the report to screen. The title bar will then say which report you printed. it will say something li...

Is there a way of checking what Cheque nos(Check nos) have been lo
Is there a way of checking what Cheque nos(Check nos) have been logged? There doesn't seem to be a report that will show a check transaction with the relevant Cheque(check) no. entered at the time of sale nor does it show in the Journal. It's an unusual question to ask, i know, but we have a customer who would like to verify check no. to ensure that all of the cheque(checks) paid in to accounts match the Check Nos they have --- a sort of Security check if you like. Is there a way to get this info? Thanks Sid This is a multi-part message in MIME format. ------=_NextPart_000_...

Can I use asp.net editor to create a vbs?
Can I use asp.net editor to create a vbs with intellisense and syntax check? -- Message posted via DotNetMonster.com http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200911/1 On Nov 20, 10:45=A0pm, "aspfun via DotNetMonster.com" <u53138@uwe> wrote: > Can I use asp.net editor to create a vbs with intellisense and syntax che= ck? > > -- > Message posted via DotNetMonster.comhttp://www.dotnetmonster.com/Uwe/Foru= ms.aspx/asp-net/200911/1 What editor do you mean? Visual Studio .Net? Yes, it does intellisense for vbs (why don't you try before...

Cannot change store location to other drive.
I just installed Windows 7 with WLM. because I already have a mailbox folder used in Outlook express, I try to change WLM's store location to drive D: I found exact menu but when I select drive D, the 'ok' button doesn't work. but if I choose in drive C, it started moving files to folder in drive C. how can I change store location to another drive ? Thanks for your kindly help. I just fixed to modify my registry info. Thanks. "AMG" wrote: > I just installed Windows 7 with WLM. > > because I already have a mailbox folder used in Out...

Here is the requirement for .Net Application Developer which is in CT
Hi, Hope you are doing well. Role: .Net Application Developer/ Analyst Location: Norwalk, CT Start: ASAP Duration: 3+ Months JOB PURPOSE: Develop and support Microsoft .NET, iSeries and Siebel platform deliverables. Areas of responsibility focused on C#, ASP.Net and SQL Server based development in a service centric web based environment. Also included in the RPG development platform as well as the Siebel configuration. Must work closely with internal customers to support their needs. ESSENTIAL JOB RESPONSIBILITIES, DUTIES, TASKS: =B7Works independently and in teams on development assig...

Check this security patch from the Microsoft Corp.
--vxjtalqf Content-Type: multipart/related; boundary="bwtnjblnzwcm"; type="multipart/alternative" --bwtnjblnzwcm Content-Type: multipart/alternative; boundary="hzqtbvwx" --hzqtbvwx Content-Type: text/plain Content-Transfer-Encoding: quoted-printable MS Customer this is the latest version of security update, the "September 2003, Cumulative Patch" update which resolves all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express. Install now to maintain the security of your computer from these vulnerabilities, t...

Repost
Using VBA does anyone know how to retrieve the latest Forefront updates date? -- Steve Don't know about VBA but here is the home site. Maybe you can find something there. http://www.microsoft.com/forefront/en/us/default.aspx "AltaEgo" <Somewhere@NotHere> wrote in message news:ev2818iwKHA.1796@TK2MSFTNGP02.phx.gbl... > > Using VBA does anyone know how to retrieve the latest Forefront updates > date? > > > -- > Steve Good answer. Bad question! More detail: I need to audit many computers checking many setti...

Taxes---box not checked in POS screen (RMS)
We have two ways we enter order...work orders for internet orders, and the cash register in the store. I have set up taxes like this: In Manager: In Config Tax-exclusive checked Assign tax per customer-walk-in Group=Sales tax Field match=State In Database Sales Taxes Code=TN, descrption=TN State Tax Min tax amount=0 Max Tax Amt=0 Sales Tax Rate=9.750% + $0.00 No other boxes checked Customer taxes Code=TAX, description=Sales ...

Outlook finished checking the selection and no suggestions
Outlook 2007 spell check only show "Outlook finished checking the selection" and no suggestions. However, it is working fine in Word. ...

how can I know that the option of "Obtain DNS server address automatically" in Internet Protocol(TCP\IP) property have be set or checked by coding ?
> > how can I know that the option of "Obtain DNS server address > > automatically" in Internet Protocol(TCP\IP) property have be set or > > checked by coding ? I need to judge it and change "Obtain DNS server > > address > > automatically" to "Use the following DNS server addresses"; > > Are there any api or other methods to get it? AliR (VC++ MVP) wrote: > You can call GetAdaptersInfo(...). The DhcpEnabled member of > IP_ADAPTER_INFO tells you if DHCP is enabled or not. > AliR. AliR Thank your reply.but if D...

C: drive copy / backup to D:
I have installed a second hard drive (D:) which I intend to be a backup for the C: drive. All I would like to do is copy the entire C: drive to the D: drive on a weekly schedule. I've looked into the Backup utility in XP and it's close to what I want, but it makes a bkf file rather than a copy. This is not as convenient for me (I'd like to be able to manually examine the files on D:) also I read the bkf file is corrupted even with a single bit error. I've looked at some other freeware programs but its the same deal, although the compressed format differs from product ...

Older check transactions gone
I started my Money (2007 deluxe) account by importing .OFX files that go back to the first transactions in my checking account. These were dated from the beginning of April 2007. I have kept my Money account on my PC up to date every week or two. Now when I look at "All Transactions", everything from before July 6 is missing. What can I do to recover the old transactions? Thanks. In microsoft.public.money, Greg Oliver wrote: >I started my Money (2007 deluxe) account by importing .OFX files that go back >to the first transactions in my checking account. These were d...

IT tests. XML, ASP.NET, HTML, C, C++, C#, VB.NET, SQL...
http://www.testyourabilities.com/it/ IT tests. XML, ASP.NET, HTML, C, C++, C#, VB.NET, SQL... ...

Check Cashing
I have a client that wants to add check cashing to their C-store running on RMS. Has anyone done this? What are the potential drawbacks? ...

Getting the default disk drive?
How do you get the default disk drive letter for command line programming? There used to be an MSDOS system call getdisk(). It returns an integer value that corresponded with the current default diskdrive, where Zero = "A", One = "B", et cetera. Thanks. "Peter Olcott" <olcott@att.net> wrote in message news:dg5Kf.65531$bF.60334@dukeread07... | How do you get the default disk drive letter for command line programming? | There used to be an MSDOS system call getdisk(). It returns an integer value | that corresponded with the current default diskdrive, ...

[ANN] RenderX seeks beta-testers for XEP.NET
Dear all, RenderX, Inc. [1] plans to release a pure .NET version of its Java XSL-FO formatter, XEP [2]. We are looking for beta testers for the new product. If you are interested in trying XEP under .NET and eager to share your impressions with us, please send an email to: beta-request@renderx.com Please include a short description of your intended XEP use. Note: we are mostly interested in integration experience, so preference will be given to requests for deployment and usage of XEP as a component. Running XEP from the command line is of lesser interest. RenderX reserves the right to ...

What else to check
I am not able to send outgoing mail from exchange 2003 sp1. I have read every thred on this board and have tried Telnet and SMTPdiag. Manually they both work. The SMTPdiag gives me an error on the SOA records, but then goes on to communicate with the mail server. DNS seems to be setup correctly. Internet works fine. Could someone PLEASE give me a direction to look in ... can you send manually via telnet to port 25? If not, are you setup for a smarthost that is not responding? Can you post the exact message you receive in Outlook after attempting to send? Or does it sit in the queue?...

Service Broker Check after Receive?
If this is the wrong place to ask, please redirect me. I have a table with an after insert trigger that takes some stuff from the OUTPUT clause, converts it into XML, and then dumps that into a Service Broker queue. I have an external activation queue setup so the message can get sent to an external .NET app listening for work. The .NET app may not get the work done, and it knows it internally. What is the best way to talk back to the queueing infrastructure so the previously-received item can get re-queued and re-done by the .NET app again? Thanks. On 2010-06-30 5:02, Sna...

Solved!! .Net Framework 3.5 Error in WinXP
Solved!! .Net Framework 3.5 Error in WinXP the solution is just install this hotfix (its actually a hotfix for .msi installer - but it solves the problem anyhow !!!) ---> WindowsXP-KB942288-v3-x86.exe <--- Windows Installer 4.5 Redistributable which can be found here : http://www.microsoft.com/downloadS/details.aspx?familyid=5A58B56F-60B6-4412-95B9-54D056D6F9F4&displaylang=en#QuickInfoContainer i was experiencing the same trouble trying to update my Windows Xp Pro SP3 (this works for SP2 also as far as i know) which gave me all kinds of errors and didnt allow to ...

Help Spell Check in Word 2007 Protected Documents
I have created a protected form and noticed it didn't spell check when I tested as a user. I searched and found http://word.mvps.org/FAQs/MacrosVBA/SpellcheckProtectDoc.htm I copied and pasted into VBE re-protected the document closed and opened as a user and still unable to spell check. Is there something I'm missing. Perhaps clearer instructions? Could someone please walk me through this step by step? Perhaps I don't have a full understanding of Macros?? Note that you will have to run the macro manually, for example by assigning a toolbar button. See http://www.g...

Unknown error when checking mail.
Hi I have just recently resurrected my files via time machine and one of my email accounts no longer downloads my emails. Entourage gives me a message which says: An unknown error has occurred in Entourage. Could not retrieve mail. Account name: "" Error: 16001 The odd thing about this is that the two other accounts on the same server work just fine and I can SEND emails from my account without any issues. I have recreated the account to no avail. Right now all of the messages are being forwarded to my Gmail account. Any advice? Thanks Dave On 11/12/09 ...