Delete OLEObjects in Break Mode

er300905

New Member
Joined
Jan 19, 2009
Messages
1
Hi,

I am writing some code that will create random data which will be used in a specific sheet to calculate certain values using the cell formulas. This sheet will be copied as many times as necessary to input the numbers generated (The code will generate a different set of numbers for a certain amount of loops, so a new copy of the sheet will be needed each time).
Once the data in inputted into the sheet, it will do some math using the cell formulas. If the results of this math are not the desired, the code will delete the sheet.

My problem begins here. There is an ActiveX checkbox in the base sheet (which gets copied every time). My code works fine if I let it run, BUT if I am in break mode (debug mode) the debugger breaks after
Code:
ActiveSheet.Delete
It says "Can't enter break mode at this time” and makes me choose between ending the code or running it.
I have googled for a couple of hours looking for ways around this but my options are not what I’d like to do. <o:p></o:p>
This is what Microsoft has to say about it:<o:p></o:p>
“A change was made programmatically to the project using the extensibility (add-in) object model. This prevents the program from having execution suspended. You can continue running, or end execution, but can't suspend execution.”<o:p></o:p>
So the reason why it breaks is because I'm deleting the OLE Object (checkbox). One way around this is to change the ActiveX checkbox to a Form checkbox, but this will mean that I have to change a lot of code where I do some checks and tests on the OLE Object.<o:p></o:p>
Another way around (not likely to be done) is to entirely get rid of the checkbox and just use a cell with True or False values, but in my opinion this approach will take the professional look off of the sheet.

<o:p></o:p>
So in a nutshell, I want to delete an OLEObject in break mode and be able to stay in it.<o:p></o:p>
I know I should listen to what Microsoft said and throw in the towel, but I'm hoping there is someone who had this problem and found a better way around it. <o:p></o:p>
<o:p> </o:p>
Any help is highly appreciated.


Regards,

<o:p></o:p>
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,214,932
Messages
6,122,334
Members
449,077
Latest member
Jocksteriom

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