"Code Execution Has Been Interrupted" (1 Viewer)

XLEAccessGuru

XLEGuru
Local time
Today, 13:22
Joined
Nov 17, 2006
Messages
65
Hi Everyone!

In Excel VBA, and ONLY on my laptop at work, I get run-time messages that say "Code Execution Has Been Interrupted" just as if I hit CTRL + BREAK. I have NOT hit break and this only happens on my laptop at work. The same exact program will run perfectly on any other machine but just seems to stop as if I manually interrupted it on the laptop. It will stop on something stupid like:

Code:
    Sheets("MainMenu").Select

I have been struggling with this for MONTHS. Several of my automated reports can't run overnight outside of business hours like they need to because of this.

If anyone can save me here, I will be eternally grateful! I've tried EVERYTHING.

Remember - this only happens on my laptop. If I run the any of these Excel automation programs on ANY other machine, it runs all the way through without being interrupted.

Awaiting my Savior,
XLEAccessGuru
 

unmarkedhelicopter

Registered User.
Local time
Today, 18:22
Joined
Apr 23, 2007
Messages
177
Try using Worksheets("MainMenu").Select or ActiveWorkbook.Worksheets("MainMenu").Select or ThisWorkBook.Worksheets("MainMenu").Select (depending on which you feel is most applicable and see if you get the same result.
 

Tanner65

Registered User.
Local time
Today, 12:22
Joined
Aug 31, 2007
Messages
66
I've having a similar issue, the code worked find in the past, but about a week ago, it started getting angry with me.

It seems to be happening after almost all of my SQL queries which are restricted to a single module. Below is some code. The queries are completing correctly and updating the worksheet, but I'm getting the same window "Code Execution Has Been Interrupted."

So far I've tried:
Copying the modules to text files, removing the modules and pasting the code into new modules with the same names as to not have to recode.
Uninstalling/Reinstalling Microsoft Office XP which fixed the problem for two days
Codecleaner v4.5 and codecleaner v5.0

I don't have the ability nor anyone elses time to try this on someone elses computer, otherwise I would.

Code:
Sub qrySOMaster(strCell As String, iSOrder As String)
    Range(strCell).Select
    With Selection.QueryTable
        .Connection = ******
        .Sql = ("SELECT ""SO Master"".ORDNUM_27, ""SO Master"".CUSTPO_27, ""SO Master"".TERMS_27, ""SO Master"".SHPVIA_27,  ""SO Master"".FOB_27, ""SO Master"".ORDID_27, ""SO Master"".REP1_27, ""SO Master"".ORDDTE_27, ""SO Master"".CUSTID_27, ""SO Master"".NAME_27, ""SO Master"".ADDR1_27, ""SO Master"".ADDR2_27, ""SO Master"".ADDR3_27, ""SO Master"".CITY_27, ""SO Master"".STATE_27, ""SO Master"".ZIPCD_27,  ""SO Master"".CNTRY_27, ""SO Master"".COMNT3_27 FROM ""SO Master"" ""SO Master"" WHERE (""SO Master"".ORDNUM_27='" & iSOrder & "')")
        .Refresh False
    End With   '<------Stops here every time
End Sub

iSorder is the Sales Order number entered by the user.


I can't find anyway to fix it, please help!


Edit:
After pressing F5 and "c" through it, I've found that it also errors on my clear button.
Code:
Private Sub ClearButton_Click()
    Application.ScreenUpdating = False
    modCleaning.ClearData "Clear"
    Application.ScreenUpdating = True
End Sub '<----Error's here
 
Last edited:

Tanner65

Registered User.
Local time
Today, 12:22
Joined
Aug 31, 2007
Messages
66
So, I've come across a way to fix the problem.

When it starts doing that, if I clear all breakpoints and save, then restart my computer it'll run fine for awhile.

Must be some windows cache thing or something of that sort that gets bogged down.


Hope this helps someone.
 

Users who are viewing this thread

Top Bottom