我需要一个更好的解决方案来处理未就绪的驱动器,并且希望能够查看和更改我的 rw 驱动器中的文件。不幸的是,它总是给出驱动器未就绪错误,我唯一能做的就是处理错误。
到目前为止,我已经这样做了:
我的驱动器:
Private Sub imperialdrive_Change()
On Error GoTo I_have_a_baad_feeling_about_this
imperialdir.Path = RootPathOnDrive(imperialdrive.Drive)
Exit Sub
I_have_a_baad_feeling_about_this:
If Err.Number = 68 Then
MsgBox "The selected drive is not available at the moment.", vbOKOnly, "I feel a disturbance in the force."
Else
MsgBox Err.Number & " " & Err.Description, vbCritical, "There is a Bounty Hunter here."
End If
End Sub
我的功能:
'Such a bad choise for a function name
'It sounds like doing smt more than changing the name of drive lol
Public Function RootPathOnDrive(ByVal Drive)
'So how it comes as "k:" instead of "k:\" Is it really cause its not ready? Both ways i should try reaching "k:\"
RootPathOnDrive = Left(Drive, 1) & ":\"
End Function