On error resume next doesn't resume next

  • Thread starter ragtopcaddy via AccessMonster.com
  • Start date
R

ragtopcaddy via AccessMonster.com

Here's my code:

On Error Resume Next
rs.Close
Set rs = Nothing
wkBk.Close
Set wkBk = Nothing
xlObj.Quit
Set xlObj = Nothing
End Function

Most of the time, the workbook will be closed. My intention is that, if the
wkbk is already closed and/or set to nothing, the next line of code should
execute. It doesn't. Instead I get Run-time error '91' - "Object variable or
With block variable not set" and the code stops at "wkBk.Close". Where am I
going wrong?
 
K

Klatuu

In the VB editor:
Tools, Options, General Tab
Be sure Break on unhandled errors is selected
 
R

ragtopcaddy via AccessMonster.com

Klatuu,

Thanks for the reply. It is already selected. It's puzzling that precisely
the behavior one is trying to avoid by using On Error Resume Next would occur.


Regards,


In the VB editor:
Tools, Options, General Tab
Be sure Break on unhandled errors is selected
Here's my code:
[quoted text clipped - 12 lines]
With block variable not set" and the code stops at "wkBk.Close". Where am I
going wrong?
 
Top