Function GetDriveType(strMappedDrive As String) As String
Dim objFso As Object
Dim strDrive As String
Dim d
With CreateObject("Scripting.FileSystemObject")
strDrive = .GetDriveName(strMappedDrive)
On Error GoTo ErrHandle:
Set d = .GetDrive(strDrive)
Select Case d.DriveType
Case 0: t = "Unknown"
Case 1: t = "Removable"
Case 2: t = "Fixed"
Case 3: t = "Network"
Case 4: t = "CD-ROM"
Case 5: t = "RAM disk"
End Select
End With
GetDriveType = t
ErrHandle:
If Err.Number > 0 Then
GetDriveType = "Drive not found"
End If
End Function
Sub Test()
Dim y As String
y = Split(ThisWorkbook.Path, "\")(0)
x = GetDriveType(y)
Debug.Print x
End Sub