Code execution has been interrupted

W

Who I Am

Whenever I run a code, it stops at a point. I could not find obvious
coding errors. If I press F8/F5, or hit the botton "continue", the code
gets executed again and more more halt.

The following help from VBA does not help, or I don't understant it.

Can you please shed a light?

Thanks

HZ



Code execution has been interrupted

Code execution can be suspended when necessary. This condition has the
following cause and solution:

A CTRL+BREAK (Microsoft Windows), ESC (Microsoft Excel) or
COMMAND+PERIOD (Macintosh) key combination has been encountered.
In the error dialog box, click Debug to enter break mode, Continue to
resume, or End to stop execution.
 
R

Rob Bovey

Who I Am said:
Whenever I run a code, it stops at a point. I could not find obvious
coding errors. If I press F8/F5, or hit the botton "continue", the code
gets executed again and more more halt.
The following help from VBA does not help, or I don't understant it.
Can you please shed a light?

This is sometimes a sign of corruption in your VBA code. Download my
code cleaner utility from the web site below and run it on your project to
see if that will fix it.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm
 
W

Who I Am

Thanks a lot, Rob. Now I am working on company's computer, so I cannot
download your code.

There are several typos in my original message. After I hit F8/F5,
there is no more halt.

The following is the piece of my code that causes this problem. The
halt happens just after the subtotaling.

DataSheet.Activate
With ActiveSheet
.Range("A2").Select
Selection.CurrentRegion.Select
Selection.Subtotal GroupBy:=2, Function:=xlCount,
TotalList:=Array(1, 30) _
, Replace:=True, PageBreaks:=False, SummaryBelowData:=True
.Range("A2").Select
For Each c In .Range(.Range("A2"), .Range("A55000").End(xlUp))
c.Activate
If WorksheetFunction.IsNumber(ActiveCell) Then
ActiveCell.EntireRow.Clear
End If
Next c
.Range("A2").Select
End With
 
R

Rob Bovey

This still sounds like a potential code corruption issue to me. The code
cleaner is just a plain vanilla Excel add-in, so if you can download and
install it on your home computer you could just e-mail yourself a copy of
the VBACodeCleaner.xla workbook and load it by using File/Open in Excel.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm
 
M

Mariano B.

Rob,

I do too get the "Code execution has been interrupted" message, i have
already tried your code cleaner (thanks by the way) but i still get it. On
my computer the macro works fine, but as i tried to use it on another machine
is when i get the problem.
The macro is about getting data from a mysql database using the MyODBC driver.
Everytime i get this message, the macro can continue, there is no obvious
error on the code.

Here is a fragment of the code where the macro stops:

Sub actores(aux As String)
Dim connstring As String
Dim query2 As String

connstring =
"ODBC;DATABASE=DBNotas;DSN=DBNotas;OPTION=0;PWD=noseasmetiche;PORT=0;SERVER=192.168.1.218;UID=NotasExcel"
query2 = "SELECT Id, Nombre FROM Secciones ORDER BY nombre"

Sheets("AUX").Cells.Delete

With Sheets(aux).QueryTables.Add(Connection:=connstring,
Destination:=Sheets("AUX").Range("A1"), Sql:=query2)
.name = "Actores"
.BackgroundQuery = False
.Refresh
End With
'Sheets("AUX").Rows(1).Delete
End Sub

the arrow points at the line with the End With command

Thank you very much
 
C

Casa

Rob said:
This is sometimes a sign of corruption in your VBA code. Download my
code cleaner utility from the web site below and run it on your project
to
see if that will fix it.

Rob,
I downloaded your CodeCleaner, installed it and ran it. Ironically XL
had another interrupt within your code! I 'continued' the code and it
ran to the end. Unfortunately the problem persists. Are there any other
solutions out there?
C.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top