View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Steve D Steve D is offline
external usenet poster
 
Posts: 22
Default Error Handling - On Error GoTo doesn't trap error successfully

I am having this problem and it is because of a GoTo in the error handler.
The problem is that I need to stop the code on the error and go back to a
specific point in the macro or I get stuck in a loop. Below is a brief piece
of my code. Any help would be greatly appreciated.

Sub abc()

Dim.........
Set Variable Values............

Res1:
Do While Range("PathList!A" & v_pathrow).Value < Empty

v_path = Range("PathList!A" & v_pathrow).Value
On Error GoTo ErrorLg
Workbooks.Open Filename:=v_path '*****Point of
most errors
Sheets("Cover Page").Select
v_cc = Range("c16").Value
v_currow = 1
Do While Range("F" & v_currow).Value < "Total Count"
v_currow = v_currow + 1
Loop '***Loop I get stuck in


ActiveWindow.Close (False)


v_pasterow = v_pasterow + 1
v_pathrow = v_pathrow + 1
Loop
Rows(v_pasterow & ":" & v_pasterow + 1).Select
Range("A18").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Exit Sub

ErrorLg:
Range("ErrorLog!A" & v_errorrow).Value = v_path
v_errorrow = v_errorrow + 1
v_pathrow = v_pathrow + 1
Rows(v_pasterow & ":" & v_pasterow).Select
Selection.Delete Shift:=xlUp
Err.Clear
GoTo Res1
--
Thank You,
Steve


"Bill Schanks" wrote:

One thing I would suggest ... in the error handling routine do you
have:

Goto xxx

OR

Resume xxx

If you have goto then the error routine will not catch a second error,
as it is technically still in the error handling step.