LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Error Handling

Always have problems with the error handlers in my macros.

The macro below opens a file then does some other stuff to it but the
error handler does not seem to work and i still get an error if the
file is missing (error 1004 to be precise)

'opens the adjustments file
filepath = ThisWorkbook.Path & "\adjustments.xls"
On Error GoTo nofile1 'specifc error
handler
Workbooks.Open Filename:=filepath 'cause of potential error
On Error GoTo 0 'reset default
error handler
GoTo contadj2

'missing adjustments.xls error handler
nofile1:
On Error GoTo 0
adjust = MsgBox("The Adjustments file is missing, Do you wish to
continue without incorporating any adjustments?", vbYesNo)
If adjust = 6 Then
GoTo contadj2
Else
GoTo abortend
End If

contadj2:
REST OF MACRO

abortend:
end sub

Any ideas why it does not work, or many of the other handlers which
are similar in nature?

Thanks in advance

Richard

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Handling - On Error GoTo doesn't trap error successfully David Excel Programming 9 February 16th 06 05:59 PM
Error handling with a handling routine ben Excel Programming 0 March 15th 05 03:01 PM
error handling jeffP Excel Programming 1 July 3rd 04 06:10 PM
Error Handling bw Excel Programming 3 June 20th 04 06:43 PM
Error handling John Pierce Excel Programming 3 October 3rd 03 12:17 PM


All times are GMT +1. The time now is 09:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"