Changing the VBE's settings programmatically

ChrisOswald

Active Member
Joined
Jan 19, 2010
Messages
454
Hi,

I'm having some problems with some code breaking on other peoples computers. The code breaks are all in this type of format:
Code:
on error resume next
'do something that deletes something that might not exist
on error goto 0

I've figured out that it's caused by the VBE having Tools -> Options -> General -> 'Break on all errors' selected.

What I want to know is if there's a way to change the setting programmatically, or if I'm going to have to run around to everyone's computer and change it. Or if there's a better way to handle this, because as cpearson.com says:
CAUTION: Many VBA-based computer viruses propagate themselves by creating and/or modifying VBA code. Therefore, many virus scanners may automatically and without warning or confirmation delete modules that reference the VBProject object, causing a permanent and irretrievable loss of code. Consult the documentation for your anti-virus software for details
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Well, it looks like Chip Pearson's still right...

Code:
Sub DontDoThis()
    Dim AppAcc As Object
 
    Set AppAcc = CreateObject("Access.Application")
    AppAcc.setoption "Error Trapping", 0
    AppAcc.Quit
    Set AppAcc = Nothing
End Sub

doesn't change the current VBE setting, but it does change future VBE settings. Unless you're putting this in an Access module, I guess. Although, I guess this exact code in Access wouldn't change the calling instance.

That's twice today I found an excuse to create a second instance of a MSOffice program. I think I might be coming down with something.
 
Upvote 0

Forum statistics

Threads
1,215,836
Messages
6,127,175
Members
449,368
Latest member
JayHo

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