Pete's Windows, Office, VB & SQL Blog

Problems I have solved (or not) and good ideas I've found

Posts Tagged ‘excel

code execution has been interrupted

leave a comment »

After running my macro like this:

set apExcel = CreateObject(“Excel.Application”)
set wkBook = apExcel.Workbooks.Add (“C:\SpreadSheet.xls”)
apExcel.run “A_Macro”
wkBook.Close
apExcel.Quit

It stopped with the message “code execution has been interrupted” next time I ran it in Excel on my desktop.  I’d not seen this message before.  Clicking ‘Continue’ worked the macro executed that line of code and many more until it got back to that line later, then the message appeared again.  About four lines exhibited the problem, I recognised them as lines I had se breaks on during development.  I have occasionally experienced a problem where breaks don’t actually leave the code, even though the markers do.  So I hit F9 twice – to set and unset the breakpoint – to no effect.  I tried ‘clear all breakpoints’ – to no effect.

I found a solution here, which seems to have worked.   The entry is Oct 13th, 2009, 02:35 PM, by akforsyt.  IT is simple to go into debug and press Ctrl+break.

Written by fisherpeter

2010 July 21 at 09:33

Posted in Office 2003

Tagged with , ,

Follow

Get every new post delivered to your Inbox.