The TypeOfDrive Function : Drive « File Path « VBA / Excel / Access / Word






The TypeOfDrive Function

 
Function TypeOfDrive(ByVal strDrive As String) As String
   Dim intDriveType As Integer
   Dim strDriveType As String

      intDriveType = abGetDriveType(strDrive)
      Select Case intDriveType
         Case DRIVE_UNKNOWN
            strDriveType = "Type Unknown"
         Case DRIVE_UNAVAILABLE
             strDriveType = "Drive Doesn't Exist"
         Case DRIVE_REMOVABLE
             strDriveType = "Removable Drive"
         Case DRIVE_FIXED
             strDriveType = "Fixed Drive"
         Case DRIVE_REMOTE
             strDriveType = "Network Drive"
         Case DRIVE_CDROM
             strDriveType = "CD-ROM"
         Case DRIVE_RAMDISK
             strDriveType = "RAM Disk"
      End Select
      TypeOfDrive = strDriveType
End Function

 








Related examples in the same category

1.Get Drive Information
2.The NumberOfBytesFree Function
3.Returns the number of free bytes for a drive
4.Returns the total storage capacity for a drive
5.Returns a string that describes the drive type
6.Returns True if a specified drive letter exists
7.Returns the number of drives
8.Returns the drive letter using an index
9.Display Drive information