VBA Errors Question

Sthrncali

Board Regular
Joined
Apr 1, 2011
Messages
226
I am seeing some strange behavior from a specific computer, and was curious if anyone else has ever seen this. I am confident the issue does not lie within the VBA code itself, as it runs fine most of the time on this computer, and always runs without error on my second computer running the same OS / MS Excel.

The behavior is that if I force stop a macro (CTRL + Break) OR sometimes if a macro legitamately bugs out on this computer, its like something gets "stuck" in the memory and subsequently after that all macros throw an error on random lines of code until I reboot the computer.

That is to say, established macros that are not in development throw errors. The strangest part is I can continue through the code hitting F8, and successfully get to the end of the macro with it completing everything that it was supposed to do, only it stops every couple of seconds and tosses me into VBE with a random line highlighted..

My IT Department has re-imaged my computer several times since this behavior started, but it has persisted...

Was curious if anyone else has ever witnessed this that could maybe shed some light onto the most likely culprits... Its seems if there was a hardware issue (like a memory leak) that I would experience other symptons outside of Excel VBA, however that is not the case...

Thoughts? Suggestions? Ideas?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
I have heard of similar behaviour. Try adding:
Code:
Application.Enablecancelkey = xldisabled
to the start of the code and then rest to xlInterrupt at the end.
 
Upvote 0
This did resolve the error..

Thank you for that!

Next question... What does this do? And would it be bad to leave it disabled..

Reason I ask is otherwise I would need to add this to every macro I use, which is not feasible...

But I could easily add it to he Auto-Open event of each workbook I use. So long as disabling this doesn't have any other adverse effects..
 
Upvote 0
It seems to be an odd quirk that some machines have, which seems to simulate pressing Esc. This code disables the Esc. Up to you if you wish to run with no means of stopping your code... :)
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,682
Members
452,937
Latest member
Bhg1984

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top