Run time 75 Error path/file access no-how to trap???

P

pano

Hi Like some help where oh where to trap this error in the below code.
If USB stick is not in laptop it just comes up with debug window

Thanks Stephen

Sub SAVETOUSBSTICK()
' SAVETOUSBSTICK Macro
' Macro recorded 19/03/2007 by *
Application.DisplayAlerts = False
ChDir "d:\"
ActiveWorkbook.SaveAs Filename:="d:\April.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=True
Application.DisplayAlerts = True
End Sub
 
P

papou

Hello pano

Sub SAVETOUSBSTICK()
' SAVETOUSBSTICK Macro
' Macro recorded 19/03/2007 by *
On Error GoTo SAVETOUSBSTICK_Error

Application.DisplayAlerts = False
ChDir "d:\"
ActiveWorkbook.SaveAs Filename:="d:\April.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=True
Application.DisplayAlerts = True

On Error GoTo 0
Exit Sub

SAVETOUSBSTICK_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
SAVETOUSBSTICK"
End Sub

HTH
Cordially
Pascal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top