![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Posts: 63
|
Once you turn on “On Error Resume Next”, how do you ‘turn it back off?
Consider this code as one sample of the problem. On Error Resume Next DoCmd.DeleteObject acTable, "OldTable" DoCmd.CopyObject , "NewTable", acTable, "OldTable" {more statements} I delete a working table, then copy another table to that name. I don’t care if the table is already gone, so the Resume Next continues execution. But I DO care if the next CopyObject or any of the statements after that have errors. I could build a On Error GoTo routine, but what I really want is to just reset the On Error trapping back to the way it was before an On Error statement changed it. Sort of “On Error Halt”. Can this be done? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
You turn it "off" with
On Error Goto 0 |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: May 2002
Posts: 63
|
Thank you. That worked perfectly. I had read about On Error Goto 0 in help, but had misunderstood it. I thought it disabled error checking altogether. Nice that there is such a simple solution!
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|