sub try
on error goto SkipErr
dir("A:\*.*")
msgbox "OK"
exit subSkipErr:
msgbox "No Disk"
exit sub
end sub
必须先读一次,否则无法判断!

解决方案 »

  1.   

    ' ***************************************************************************
    ' 模块说明:简化了FSO操作的一些函数
    ' ===================================================================='              http://mndsoft.my163.com 
    ' ------------------------------------------------------------------' 驱动器信息
    ' ------------------------------------------------------------------  Private Type DriveInfo
           DriveLetter      As String
           ShareName        As String
           Path             As String
           RootFolder       As String
           SerialNumber     As String
           VolumeName       As String
           TotalSize        As String
           AvailableSpace   As String
           FreeSpace        As String
           DriveType        As String
           FileSystem       As String
           IsReady          As String
      End Type
      
      Public DI As DriveInfo
    Public Function IsDriveReady(ByVal strDrive As String) As Boolean
       
    ' ***************************************************************************
    ' 函数:          IsDriveReady
    ' 说明:          检查一个驱动器是否已经准备好
    ' 语法:          IsDriveReady("A:")
    ' 参数:          strDrive - 要检测的驱动器
    ' 返回值:        True表示已经准备好,False则反之
    ' ===========================================================================
      Dim FSO As New Scripting.FileSystemObject
      strDrive = StrConv(Left(strDrive, 1), vbUpperCase)
      Select Case Asc(strDrive)
             Case 65 To 90
                  strDrive = strDrive & ":"
                  IsDriveReady = FSO.GetDrive(strDrive).IsReady
             Case Else
                  IsDriveReady = False
      End Select
      Set FSO = Nothing
     End Function
      

  2.   

    Private Type DriveInfo
           DriveLetter      As String
           ShareName        As String
           Path             As String
           RootFolder       As String
           SerialNumber     As String
           VolumeName       As String
           TotalSize        As String
           AvailableSpace   As String
           FreeSpace        As String
           DriveType        As String
           FileSystem       As String
           IsReady          As String
      End Type
      
      Public DI As DriveInfo
    Public Function IsDriveReady(ByVal strDrive As String) As Boolean
       ' 函数:          IsDriveReady
    ' 说明:          检查一个驱动器是否已经准备好
    ' 语法:          IsDriveReady("A:")
    ' 参数:          strDrive - 要检测的驱动器
    ' 返回值:        True表示已经准备好,False则反之

      Dim FSO As New Scripting.FileSystemObject
      strDrive = StrConv(Left(strDrive, 1), vbUpperCase)
      Select Case Asc(strDrive)
             Case 65 To 90
                  strDrive = strDrive & ":"
                  IsDriveReady = FSO.GetDrive(strDrive).IsReady
             Case Else
                  IsDriveReady = False
      End Select
      Set FSO = Nothing
     End Function
      

  3.   

    弄个DOS版HD-COPY来,里面有示例