Function GetDrive() As String
'引用:Microsoft Scripting Runtime
'功能:返回驱动器字符串。
'示例:me.驱动器列表.RowSource="驱动器;类型;空间;可用空间;" & GetDrive 列表框或组合框列标题选是
Dim myFSO As New FileSystemObject
Dim myDr As Drive
Dim t As String
For Each myDr In myFSO.Drives
If myDr.DriveType = Fixed Or myDr.DriveType = Removable Then
Select Case myDr.DriveType
Case Fixed
t = "Fixed"
Case Removable
t = "Removable"
End Select
GetDrive = GetDrive & myDr.DriveLetter & ":-" & myDr.ShareName & ";" & t & ";"
GetDrive = GetDrive & myDr.TotalSize / 1024 & ";" & myDr.FreeSpace / 1024 & ";"
End If
Next myDr
End Function