problemas con Error 68
Hola amigos les consulto por que al llamar al disquete
sin estar este insertado, no me arroja el Msg RetryAbortCancel ?????????
Private Sub Drive1_Change()
On Error Goto error
Dir1.Path = Drive1.Drive
error:
If error = 68 Then resp = MsgBox("El dispositivo no está preparado", vbAbortRetryIgnore)
If resp = vbAbort Then Drive1.Drive = Dir1.Path
End Sub
sin estar este insertado, no me arroja el Msg RetryAbortCancel ?????????
Private Sub Drive1_Change()
On Error Goto error
Dir1.Path = Drive1.Drive
error:
If error = 68 Then resp = MsgBox("El dispositivo no está preparado", vbAbortRetryIgnore)
If resp = vbAbort Then Drive1.Drive = Dir1.Path
End Sub
prueba poniend0
if Error.Number = 68 then
asi sabe que debe actuar con el error 68
Suerte
if Error.Number = 68 then
asi sabe que debe actuar con el error 68
Suerte
Tambien puedes utilizar la libreria Microsoft Scripting Runtime para averiguar el estado de un dispositivo.
Lo prodias hacer de la siguiente forma
Private Sub Drive1_Change()
Dim oFSO As Object
Dim oDrive As Object
On Error GoTo Err_
Dim respuetesa
Set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.GetDrive(oDrive1.Drive).IsReady Then
Dir1.Path = Drive1.Drive
Else
Call MsgBox("El dispositivo no está preparado", vbAbortRetryIgnore)
End If
Free_References:
Set oDrive = Nothing
Set oFSO = Nothing
Exit Sub
Err_:
MsgBox Err.Description
GoTo Free_References
End Sub
Lo prodias hacer de la siguiente forma
Private Sub Drive1_Change()
Dim oFSO As Object
Dim oDrive As Object
On Error GoTo Err_
Dim respuetesa
Set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.GetDrive(oDrive1.Drive).IsReady Then
Dir1.Path = Drive1.Drive
Else
Call MsgBox("El dispositivo no está preparado", vbAbortRetryIgnore)
End If
Free_References:
Set oDrive = Nothing
Set oFSO = Nothing
Exit Sub
Err_:
MsgBox Err.Description
GoTo Free_References
End Sub
