View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
papou[_3_] papou[_3_] is offline
external usenet poster
 
Posts: 31
Default Run time 75 Error path/file access no-how to trap???

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

"pano" a écrit dans le message de news:
...
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