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
552 Views

Similar Articles

[PageSpeed] 57

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:

Checking for duplication on rows
Hello, In a particular spreadsheet, I would like to verify if the same name is listed on multiple rows. The name is entered in multiple columns on the same row, that is acceptable, but I would like to know if the name is entered on multiple rows regardless of the column. How can I check this? THANKS, karmen -- Karmen ------------------------------------------------------------------------ Karmen's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=30972 View this thread: http://www.excelforum.com/showthread.php?threadid=509495 Presume you're checking some...

Problem with VB.NET and Assembler x64
Hi, I have a 32-bit software that functioned well, but after upgrading my hardware, I wanted to transform this software in his 64-bit version. It all works except for the parameters passing to an Assembler dll that I wrote (even this is ported to 64-bit) Here is the code: VB: Private Declare Sub SUBLONG5 Lib "Codes64" (ByRef i1 As Long, ByVal cm As Long, ByRef c1 As Long, ByRef y1 As Long, ByRef p As Long, ByVal cmm As Long, ByRef c As Long) .... 'All parameters are long-type Call SUBLONG5(i1(j1m), cm, c1, y1, p(mi), cmm, c(mi)) .... Assembler: SUBLONG5 FR...

Computer is driving me crazy
I have had numerous BSOD over the last couple weeks. I have tried disk check, memory diagnostic, system restore, driver updates, etc. Last night, I decided I would try updating to Windows 7 in case there was some compatibility issue, and it wouldn't allow it because it stated SP 1 was not installed. Windows update states that it has installed successfully, but the system information doesn't show it as being installed. When I go to refresh my system update and check for new updates, it comes up with an error. Does anyone have any ideas? I have attached some recent memory d...

existing accounts not showing up on net worth reports
I have existing accounts set up, Cd's, that i have transfered to new accounts, cd's at another institution. the report for net worth over time fails to show the original cd's after the transfer. How should I have done this diferently? -- DR In microsoft.public.money, DR wrote: >I have existing accounts set up, Cd's, that i have transfered to new >accounts, cd's at another institution. the report for net worth over time >fails to show the original cd's after the transfer. How should I have done >this diferently? Forgetting for the moment how you...

How to check continuous form fields
I have a tabbed form, when I switch from one tab to another, it checks to make sure that none of the mandatory fields are missing. However the code that checks the records on tab #1 (which is the code below after the elseif), the code only checks the first record. I can not figure out how to modify the code to get it to look at other records on the form that may be present. Any suggestions on what modification I would need to make here would be helpful. thanks! If TabCtl4 = 1 Then Dim CkCtls As New Collection CkCtls.Add "DRNo" ...

Check to see if a formula is correct
I want to do something like this Sub Macro1() If Range("A1") =(=B1 + B2) Then ' This is a formula Exit Sub Else Range("C1").Select 'Has correct formula Selection.Copy Range("A1").Select Selection.PasteSpecial Paste:=xlFormulas End If End Sub How do I do this? Hi Try Sub Macro1() If Range("A1").HasFormula Then Exit Sub Else Range("C1").Copy Range("A1").PasteSpecial Paste:=xlFormulas Application.CutCopyMode = False ...

Problem With Deferral Check Links
Hi.. When i Do Deferral Check Links in File Maintenance. I am getting an error message "A remove range operation on table 'PP_File_Maintenance_Error_Log' cannot find the table. On clicking the more Info button. These messages are displayed " [Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'TEST.dbo.zDP_PP400004L_1'. [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'TEST.dbo.PP400004'. " In the database these two objects are not present. Can You Pl. tell me what to do about it. Thanks These do not...

Hard drive in another PC
My PC is going out and I wonder if the hard drive with the operating system will work in my other computer? The one going out is an HP with 512 RAM and the other is a Compact (older model) with about 200 RAM. -- milkman "milkman2283" <milkman2283@yahoo.com> wrote in message news:147B8F98-092A-4EB9-9D2C-04FC670CAB6D@microsoft.com... > My PC is going out and I wonder if the hard drive with the operating > system > will work in my other computer? The one going out is an HP with 512 RAM > and > the other is a Compact (older model) with about 200 R...

OK to delete old ,net framework?
Addremove programs shows .net framework 1.1, 2.0 sp2, 3.0 sp2, and 3.5 sp1. Can I delete the old ones? Thanks. New versions of .NET Framework do not supersede older versions. I.E., you may have a program that requires V:2 SP2, but it won't run on any other version. So, the short answer is no. -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "BobG" <bobgardner@aol.com> wrote in message news:21f2da84-d70f-4dd9-93a2-7e2f1a0895ea@e37g2000yqn.googlegroups.com... > Addremove programs shows .net framework 1.1, 2.0 sp2, 3.0 sp2, and 3...

Check out http://hackityourself.com
Guys, *Check out http://hackityourself.com* They hack email and myspace accounts for like $50, i used um before. Looks like their price even went down a few bucks. ...

asp.net page with framework 2.0 andajax
I initially made an ASP.NET page and after I added AJAX code by entering the page is the initial declaration <% @ Register Assembly = "System.Web.Extensions, Version = 1.0.61025.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 " Namespace = "System.Web.UI" TagPrefix = "asp"%> then I have write the ScriptManager in this page. In the web.config page i have write the tag <add assembly = "System.Web.Extensions, Version = 1.0.61025.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 "/></ assemblies>. Now w...

Spell Check in Outlook Express
Running a nDell Dimension 2400. When I spell check e- mail in OE I get,"An error occurred whiole the spelling was being checked.". When I set the option to always spell check before send, I get the message, "The spell check on the document was halted. Do you want to send anyway?" Can someone solve this for me. I will be grateful. This newsgroup is for support of Outlook 97, 98, 2000 & 2002 from the Office family for Windows PCs. For Outlook Express (OE) support try posting in one of these newsgroups: microsoft.public.inetexplorer.ie4.outlookexpress for OE 4.x m...

P/R adjustments after Calculate Checks
Hi, After Transactions>>Payroll>>Calculate Checks, is there an "easy" way to change/adjust the deduction amounts (ie: Federal W/H) prior to printing the checks. We are trying to do a parallel (catch-up) P/R run and changing the amounts prior to posting. Or.. should we post then use the Payroll Manual Check - Adjustment, to change it after posting. Thanks There is no way to update the information after you calculate paychecks unless you remove the build; make the adjustments; and rebuild/calculate. If you needed to determine a garnishment amount, for example, th...

Checking on two values
To count the numbers of rows that include the number "16" in column "I", I use the following formula: ANTALL.HVIS(I:I;"16") (I think this is called COUNT.IF in english) I want to count the numbers of rows that include both this and the letter "A" in column "B". (Meaning not counting rows which just fulfill one of these requirements.) How do I write this formula? (Please feel free to write the english formula, I will find out how to write it in norwegian.) Regards Johannes Hei Johannes COUNTIF takes only one criteria. You can do this wit...

HELP on NET Platform!!!
I'm trying to upgrade from ANSI C++ and visual studio 6.0 to NET Framework. I don't understand the architecture implemented to manage Value and Refernce types...i've understood that some types are value types, such as primitive, structs, enum and other types are reference types such as classe. So when i declare the first type i allocate memory in stack,instead declaring second type of variables i allocate space in heap.And also it's said that struct can be value types instead class are reference.So my question is: MyClass^ instance = gcnew MyClass(); creates dinamically an...

Saving Excel file to Network drive
I recently bought a Buffalo network drive so I can access my files from both my laptop and desktop. This works perfect for my Word documents and even my Outlook PST. The problem is when I try to save an Excel (2003) file to the network drive I get a message like File xxx.Xls is possibly changed by an other user since you last saved it, do you want to overwrite it or to save with another name. (My Office version is not in English so this is my translation of the message) This only happens if I open an existing file, it happens even after I try to save it immediately after ope...

check register template #2
at the top of the template a range of cells says stationary and if you look at it in print preview it stays on top of all other applications......does anyone know how this works???? how about you JulieD Hi Michele you mean how does row 4 & 5 get repeated on each page that you print out? if so, file / page setup - sheet tab, rows to repeat at top. Cheers JulieD "Michele" <Michele@discussions.microsoft.com> wrote in message news:BAB47D9F-6674-4395-B629-CCCBD067E89D@microsoft.com... > at the top of the template a range of cells says stationary and if you > loo...

BlazeFind loop Recovery Console wrong drive letter
Hi: When I go into the Recovery Console, the choice I get is #1 C: drive. When I installed XP or did a recovery, don't remember, my main drive changed to F: Drive by itself. I can't get the repair to work to get me out of the log on loop to do a repair of USERINIT. How can I change my choice to F: Drive. thanks...Gene "Wolverine Gene" <Wolverine Gene@discussions.microsoft.com> said this in news item news:F09C4180-85D0-469B-893E-9325B1AE21D5@microsoft.com... > Hi: When I go into the Recovery Console, the choice I get is #1 C: drive. > When I...

DBTYP.NET Studio 2010
DBTYP.NET Studio 2010 - Database Comparison Suite Released Vienna, Austria - March 8, 2010 Today, BYPsoft announced the availability of DBTYP.NET Studio 2010, the newest version of the cross-database comparison tool that compares SQL Server, MySQL and Oracle databases (schema and data). DBTYP.NET Studio 2010 is available for download from http://www.bypsoft.com. With its rich support for schema and data cross-database comparison, DBTYP.NET Studio takes the mystery out of databases, making their comparison practical and easy for programmers and database administrators everywh...

Check in vba if html document is already open.
I have a vba macro that opens an html document in IE. I want to be able have the macro check if the document is already open or not; if it is then I want to switch the focus to it rather than open another instance How can I achieve this? It is not sufficient to check if IE is running as the user may have other websites open at the time. TIA Chris ...

SafeArrayTypeMismatchException"
Hi .NET Masters :-) Please help me to get out of following situation ... There is a function in one of my dlls whose signature is as follows : my_function(integer X, integer Y, char* Z, HAD A, HAD P) Here HAD is defined as follows in one of the header files as : #define HAD LPSAFEARRAY FAR * The above dll was written in VC++ 6.0 . I use to call this function in my Visual Basic 6.0 application. Recently , I upgraded my Visual Basic application and found that its giving "SafeArrayTypeMismatchException" Declaration for my Function is as follows : Declar...

Just read an article on ADMODIFY.NET and Exchange recover?
All, Just read an article on ADMODIFY.net from msexchange.org. http://www.msexchange.org/tutorials/Using-admodifynet-a...r-Exchange-2003.html Anyways, the article explains that I can use admodify.net to switch users from one Exchange server to another Exchange server(backup or spare). I'm currently using DoubleTake to switch users from one Exchange server to another in case of disaster. From reading the article, it looks like the admodify.net does the same job as DoubleTake. Any pro's and con's from using one or the other? My main concern or use of ADMODIFY.net is to quickl...

ASP.Net Membersip Framework
Whould you recommend to still use the ASP.Net 2.0 Membership Framework to manage user accounts, etc. today with ASP.Net 3.5? Are there better alternatives today? TIA The "membership framework" may have been introduced in version 2.0, but as far as I'm concerned a more accurate description is the .NET membership framework. In short, this is the membership functionality included in .NET. Like most things in ASP.NET, there's no reason not to use this functional unless you need more customized functionality and don't mind writing it from scratch. -...

Checks
I would like to have the option when viewing a check to drill down to the remit to address and documents on the check. This would be very helpful when dealing with a vendor with multiple remit to addresses. Also, we need information from time to time about the documents that were processed but we have to exit and do a different inquiry for the document that was paid that was just viewed on the check. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button...

(.NET) MD5CryptoServiceProvider and (Win32 CSP) CryptHashData/CryptGetHashParam return two different Hash values,...
Hi, this is not a pure MFC/VC++ question but my apologizes at first. Well, i have a application that calculates the hash for a file. You can request a CALG_SHA1 or a CALG_MD5 for the File. The Process of Hash Calculation works fine, but i get two totally different Hash values for e.g. kernel32.dll when i try to get the hash with the following steps compared to the managed .NET MD5 Provider. The Hash "24d244d0a15ab17885d578d1c54d5294" comes from the following steps: CryptAcquireContextW CryptCreateHash CryptHashData CryptGetHashParam, with HP_HASHSIZE CryptGetHashParam, with HP_HASH...