VBA TIPS
Getting the drive letters

With FileSystemObject of WSH(Windows Scripting Host), you can get the drive letters and kinds of the dives.



Place following in the standard module.

Option Explicit

Sub ShowDriveList()
    Dim objDrive As Object
    Dim msg As String
    For Each objDrive In CreateObject("Scripting.FileSystemObject").Drives
        Select Case objDrive.DriveType
            Case 0: msg = msg & vbNewLine & objDrive.DriveLetter & ": Unknown"
            Case 1: msg = msg & vbNewLine & objDrive.DriveLetter & ": Removable Drive"
            Case 2: msg = msg & vbNewLine & objDrive.DriveLetter & ": Hard Disk Drive"
            Case 3: msg = msg & vbNewLine & objDrive.DriveLetter & ": Net work Drive"
            Case 4: msg = msg & vbNewLine & objDrive.DriveLetter & ": CD-ROM Drive"
            Case 5: msg = msg & vbNewLine & objDrive.DriveLetter & ": RAM Disk Drive"
        End Select
    Next
    MsgBox msg
End Sub



| HOME |
Copyright © cellmasters.net - colo's junk room All Right Reserved
ABOUT
WORKS
THE CELL MASTERS
CONTACT
LINKS
Tips and Information about Microsoft Excel|Masaru Kaji aka Colo