Here is an example to return all your drive letters.
Reqs.
1 textbox set to multi-line (txtAllDrives)
2 command buttons (cmdGetDrives and cmdClose)
VB Code:
  1. Option Explicit
  2.  
  3. Private Const DRIVE_UNKNOWN = 0
  4. Private Const DRIVE_ABSENT = 1
  5. Private Const DRIVE_REMOVABLE = 2
  6. Private Const DRIVE_FIXED = 3
  7. Private Const DRIVE_REMOTE = 4
  8. Private Const DRIVE_CDROM = 5
  9. Private Const DRIVE_RAMDISK = 6
  10. ' returns errors for UNC Path
  11. Private Const ERROR_BAD_DEVICE = 1200&
  12. Private Const ERROR_CONNECTION_UNAVAIL = 1201&
  13. Private Const ERROR_EXTENDED_ERROR = 1208&
  14. Private Const ERROR_MORE_DATA = 234
  15. Private Const ERROR_NOT_SUPPORTED = 50&
  16. Private Const ERROR_NO_NET_OR_BAD_PATH = 1203&
  17. Private Const ERROR_NO_NETWORK = 1222&
  18. Private Const ERROR_NOT_CONNECTED = 2250&
  19. Private Const NO_ERROR = 0
  20.  
  21. Private Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal lpszLocalName As String, _
  22. ByVal lpszRemoteName As String, cbRemoteName As Long) As Long
  23.        
  24. Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, _
  25. ByVal lpBuffer As String) As Long
  26.    
  27. Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
  28.    
  29. Private Function fGetDrives() As String
  30. 'Returns all mapped drives
  31.     Dim lngRet As Long
  32.     Dim strDrives As String * 255
  33.     Dim lngTmp As Long
  34.     lngTmp = Len(strDrives)
  35.     lngRet = GetLogicalDriveStrings(lngTmp, strDrives)
  36.     fGetDrives = Left(strDrives, lngRet)
  37. End Function
  38.  
  39. Private Function fGetUNCPath(strDriveLetter As String) As String
  40.  
  41.     On Local Error GoTo fGetUNCPath_Err
  42.  
  43.     Dim Msg As String, lngReturn As Long
  44.     Dim lpszLocalName As String
  45.     Dim lpszRemoteName As String
  46.     Dim cbRemoteName As Long
  47.     lpszLocalName = strDriveLetter
  48.     lpszRemoteName = String$(255, Chr$(32))
  49.     cbRemoteName = Len(lpszRemoteName)
  50.     lngReturn = WNetGetConnection(lpszLocalName, lpszRemoteName, cbRemoteName)
  51.     Select Case lngReturn
  52.         Case ERROR_BAD_DEVICE
  53.             Msg = "Error: Bad Device"
  54.         Case ERROR_CONNECTION_UNAVAIL
  55.             Msg = "Error: Connection Un-Available"
  56.         Case ERROR_EXTENDED_ERROR
  57.             Msg = "Error: Extended Error"
  58.         Case ERROR_MORE_DATA
  59.                Msg = "Error: More Data"
  60.         Case ERROR_NOT_SUPPORTED
  61.                Msg = "Error: Feature not Supported"
  62.         Case ERROR_NO_NET_OR_BAD_PATH
  63.                Msg = "Error: No Network Available or Bad Path"
  64.         Case ERROR_NO_NETWORK
  65.                Msg = "Error: No Network Available"
  66.         Case ERROR_NOT_CONNECTED
  67.                Msg = "Error: Not Connected"
  68.         Case NO_ERROR
  69.                ' all is successful...
  70.     End Select
  71.     If Len(Msg) Then
  72.         MsgBox Msg, vbInformation
  73.     Else
  74.         fGetUNCPath = Left$(lpszRemoteName, cbRemoteName)
  75.     End If
  76.    
  77. fGetUNCPath_End:
  78.     Exit Function
  79.    
  80. fGetUNCPath_Err:
  81.     MsgBox Err.Description, vbInformation
  82.     Resume fGetUNCPath_End
  83.    
  84. End Function
  85.  
  86. Private Function fDriveType(strDriveName As String) As String
  87.  
  88.     Dim lngRet As Long
  89.     Dim strDrive As String
  90.    
  91.     lngRet = GetDriveType(strDriveName)
  92.     Select Case lngRet
  93.         Case DRIVE_UNKNOWN 'The drive type cannot be determined.
  94.             strDrive = "Unknown Drive Type"
  95.         Case DRIVE_ABSENT 'The root directory does not exist.
  96.             strDrive = "Drive does not exist"
  97.         Case DRIVE_REMOVABLE 'The drive can be removed from the drive.
  98.             strDrive = "Removable Media"
  99.         Case DRIVE_FIXED 'The disk cannot be removed from the drive.
  100.             strDrive = "Fixed Drive"
  101.         Case DRIVE_REMOTE  'The drive is a remote (network) drive.
  102.             strDrive = "Network Drive"
  103.         Case DRIVE_CDROM 'The drive is a CD-ROM drive.
  104.             strDrive = "CD Rom"
  105.         Case DRIVE_RAMDISK 'The drive is a RAM disk.
  106.             strDrive = "Ram Disk"
  107.     End Select
  108.     fDriveType = strDrive
  109.    
  110. End Function
  111.  
  112. Sub sListAllDrives()
  113.  
  114.     Dim strAllDrives As String
  115.     Dim strTmp As String
  116.    
  117.     strAllDrives = fGetDrives
  118.     If strAllDrives <> "" Then
  119.         Do
  120.             strTmp = Mid$(strAllDrives, 1, InStr(strAllDrives, vbNullChar) - 1)
  121.             strAllDrives = Mid$(strAllDrives, InStr(strAllDrives, vbNullChar) + 1)
  122.             Select Case fDriveType(strTmp)
  123.                 Case "Removable Media":
  124.                     txtAllDrives = txtAllDrives & "Removable drive : " & strTmp & vbNewLine
  125.                 Case "CD Rom":
  126.                     txtAllDrives = txtAllDrives & " CD Rom drive : " & strTmp & vbNewLine
  127.                 Case "Fixed Drive":
  128.                     txtAllDrives = txtAllDrives & " Local drive : " & strTmp & vbNewLine
  129.                 Case "Network Drive":
  130.                     txtAllDrives = txtAllDrives & " Network drive : " & strTmp & vbNewLine
  131.                     txtAllDrives = txtAllDrives & " UNC Path : " & _
  132.                                 fGetUNCPath(Left$(strTmp, Len(strTmp) - 1)) & vbNewLine
  133.             End Select
  134.         Loop While strAllDrives <> ""
  135.     End If
  136. End Sub
  137.  
  138. Private Sub cmdClose_Click()
  139.     Unload Me
  140. End Sub
  141.  
  142. Private Sub cmdGetDrives_Click()
  143.     txtAllDrives = "All available drives: " & vbNewLine & vbNewLine
  144.     sListAllDrives
  145. End Sub