View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
DocBrown DocBrown is offline
external usenet poster
 
Posts: 119
Default Entering Debug after delete sheet

Did that. VBA recognizes the break point but displays that message. Can't
enter break mode at this time.

prevValue = Application.DisplayAlerts
Application.DisplayAlerts = False
On Error Resume Next <-- BreakPoint, stops here.
Sheets.Item("Lists").Delete
On Error GoTo ErrThisSub <-- BreakPoint. Message displayed?
Application.DisplayAlerts = prevValue

I hit continue, and my code encounters another failure I'm trying to locate
the source of the failure. The error I encounter Error 70' Permission
Denied.' And VBA will not allow entry into debug/break mode.

John

"Dave Peterson" wrote:

Try putting a break point before the offending line. And another after the
offending line.

Then don't step through the code after you hit that first break point--Run it.

DocBrown wrote:

You are correct, it is '... break mode ...'

Break points encounter the same message. The only enabled options buttons
are Continue or End.

The code in question is:

prevValue = Application.DisplayAlerts
Application.DisplayAlerts = False
On Error Resume Next
Sheets.Item("Lists").Delete
On Error GoTo ErrThisSub
Application.DisplayAlerts = prevValue

The sheet is deleted as expected. I'm trying to debug a problem that occurs
after this point in the code.

John S

"Dave Peterson" wrote:

I've never seen this occur after deleting a sheet.

But I have seen a similar message appear "Can't enter break mode at this time"
when I'm adding a control from the Control toolbox toolbar to a worksheet. I
can't step through that line (always????).

So I set a break point right before and after and just run to the next step.
It's almost the same.

(Are you sure it's "debug mode" in the warning message???)



DocBrown wrote:

I have a macro where it's tasks is to delete a WS and copy a replacement from
another WB. When single stepping through the code, after the
Sheets("Lists").delete, VBA will no longer allow me to enter the debug mode.
I get the message "Can't enter debug mode at this time."

Any ideas why this occurs? And how to I enter debug in this code? (other
than debug.print)

In order for the rest of the code to operate correctly, the sheet must be
deleted.

Thanks,
John

--

Dave Peterson


--

Dave Peterson