Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XL2000 - List Drive letters and folders

Status
Not open for further replies.

MarkOwen

Programmer
Sep 9, 2003
4
GB
Hi,
I am trying to write some code that will list all the Drive Letters (i.e. C:\, E:\ etc) that are available on a users computer so I can add the return values into a Combo Box on a form in Excel 2000.
For each one of the Letters I would like to list all available Folder Paths into a separate Combo Box.

Is it possible to do this and how would I go about it?

Any help will be greatly appreciated

Thanks

Mark
 
This should get you started

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top