List of Drives :: MrExcel Message Board
With Macromedia Shockwave Player, you can enjoy multimedia games, learning applications, and product demonstrations on the Web, using exciting new 3D technology. Get it at: http://www.macromedia.com/shockwave/download



 FAQFAQ
   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   StatisticsStatistics 
 RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Online StoreOnline Store

MrExcel Message Board Forum Index -> Excel Questions

List of Drives
Post new topic   Reply to topic
Last Thread | Next Thread  >   Printable version
  Author    Thread

mjbeam
Board Master


Joined: 07 Apr 2002
Posts: 232
Location: Portland, OR
Flag: Usa

Status: Offline

 Reply with quote  

List of Drives

Is there an easy way to retrieve a list of mapped drives in VBA or is it easier to just use system calls?


Thanks...Mike

Post Fri Sep 19, 2003 11:13 pm 
 View user's profile Send private message

Nimrod
MrExcel MVP


Joined: 30 Apr 2002
Posts: 2550
Location: Vancouver BC , Canada

Status: Offline

 Reply with quote  

Re: List of Drives

In VBA Help look for information on "Drive Collection"

Here's the code supplied in the VBA Help file ... I've modified slightly to allow for drives that "aren't ready".

Sub ShowDriveList()
Dim fs, d, dc, s, n
Set fs = CreateObject("Scripting.FileSystemObject")
Set dc = fs.Drives
For Each d In dc
s = s & d.DriveLetter & " - "
If d.DriveType = Remote Then
On Error Resume Next
n = d.ShareName
Else
On Error Resume Next
n = d.VolumeName
End If
s = s & n & vbCrLf
Next
MsgBox s
End Sub
_________________
NOTE: (Testing performed on Win2K utilizing Office 2000. Solutions may need tweaking for other versions.)
Adieu,Nimrod

Post Sat Sep 20, 2003 12:23 am 
 View user's profile Send private message AIM Address

mjbeam
Board Master


Joined: 07 Apr 2002
Posts: 232
Location: Portland, OR
Flag: Usa

Status: Offline

 Reply with quote  

Re: List of Drives

Very Nice! Thanks.


-Mike

Post Sat Sep 20, 2003 1:09 am 
 View user's profile Send private message
  Display posts from previous:      

MrExcel Message Board Forum Index -> Excel Questions


Forum Jump:
Jump to:  

Post new topic   Reply to topic
Page 1 of 1



Add To Favorites

 


Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB: 2.0.4 © 2001 phpBB Group

Need help posting your first question? Read how to post

Need extra help ? Couldn't get the answer you needed ? Get a free quote from our Consulting Team

Download Colo's HTML Maker utility for displaying your Excel Worksheet on the board.

Download VB HTML Maker to post your code on the board


Check out our new index to 485 Excel Articles.


Return to MrExcel Consulting

All contents Copyright 1998-2004 by MrExcel.com
If you believe information posted here is from your copyrighted source, notify us per the Terms of Use
Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.