我试了检测 Err.number ,可是,不论是没有插入软盘,还是软盘写保护,以及目录
不是软盘时如:dd:\a.txt 等错误路径时,错误号都是 52,真是怪了,请问各位大虾,
有什么办法没有?在线等,急啊!!!

解决方案 »

  1.   

    我记得用 filesystemobject 可以实现。
      

  2.   

    谢谢大家!
    to:Leemaasn(小马仙哥) 可否告诉我具体怎么用?
      

  3.   

    检测 Err.number 前,先对错误陷井初始化
    on error goto 0'错误陷井初始化
    on error resume next
    '程序,读入文件
    if err.number=52 or err.number=68 thenend ifon error goto 0'错误陷井初始化
      

  4.   

    相当于把err.number清为0。如ON ERROR RESUME RESET后跟ON ERROR GOTO 0则原有ON ERROR RESUME RESET不再起作用。On Error GoTo 0 禁止当前过程中任何已启动的错误处理程序。
      

  5.   

    我现在没办法给你ref code,
    你自己上网搜索一下file system object的方法看看吧。
      

  6.   

    Function FileErrors ()As Integer
       Dim intMsgType As Integer, strMsg As String
       Dim intResponse As Integer
       '返回值      含义
       ' 0                  继续
       ' 1                  继续下一个
       ' 2                  不可恢复的错误
       ' 3                  无法辨认的错误
       intMsgType = vbExclamation
       Select Case Err.Number
          Case MnErrDeviceUnavailable   '错误 68。
             strMsg = "That device appears unavailable."
             intMsgType = vbExclamation + 4
          Case MnErrDiskNotReady      ' 错误 71。
             strMsg = "Insert a disk in the drive "
             strMsg = strMsg & "and close the door."
             intMsgType = vbExclamation + 4
          Case MnErrDeviceIO         ' 错误 57。
             strMsg = "Internal disk error."
             intMsgType = vbExclamation + 4
          Case MnErrDiskFull         '错误 61。
             strMsg = "Disk is full. Continue?"
             intMsgType = vbExclamation + 3   
                                  '错误 64 和 52。
          Case ErrBadFileName, ErrBadFileNameOrNumber
             strMsg = "That filename is illegal."
             intMsgType = vbExclamation + 4
          Case ErrPathDoesNotExi      ' 错误 76。
             strMsg = "That path doesn't exist."
             intMsgType = vbExclamation + 4
          Case ErrBadFileMode         ' 错误 54。
             strMsg = "Can't open your file for that "
             strMsg = strMsg & "type of access."
             intMsgType = vbExclamation + 4
          Case ErrFileAlreadyOpen   ' 错误 55。
             strMsg = "This file is already open."
             intMsgType = vbExclamation + 4
          Case ErrInputPastEndOfFile   ' 错误 62。
             strMsg = "This file has a nonstandard "
             strMsg = strMsg & "end-of-file er, "
             strMsg = strMsg & "or an attempt was made ”
             strMsg = strMsg & “to read beyond "
             strMsg = strMsg & "the end-of-file er."
             intMsgType = vbExclamation + 4
          Case Else
             FileErrors = 3
             Exit Function
       End Select
       intResponse = MsgBox (strMsg, intMsgType, _
       "Disk Error")
       Select Case intRresponse
          Case 1, 4      ' “确定”、“重试”按钮。
             FileErrors = 0
          Case 5         ' “忽略”按钮。
             FileErrors = 1
          Case 2, 3      ' “取消”、“结束”按钮。
             FileErrors = 2
          Case Else
             FileErrors = 3
       End Select
    End Function该过程处理公共文件和磁盘相关错误。如果错误与磁盘输入/输出无关,则返回数值 3。
      

  7.   

    BIOS调用可以的!
    但是VB好像不好实现!
      

  8.   

    哎?怪了,今天下午给分了,szyhy810518(!?!) :40分,Leemaasn(小马仙哥) 35分,
      yimain(残雪) 10分,其他的各分了5分,怎么大家的得分还是0啊?
    当时给完分,系统有一个对话框,我没看就点了确定,是不是这个的事?现在想重新给分,可是,不行了,只能删除帖子,怎么回事?
    再次谢谢大家的帮助!!!谁能告诉我分怎么给?