Programmatically switch off "Variable declaration reqiured" in VBE?

A

Alan

Hi All,

Is there a way to programmatically switch off the 'Variable
Declaration Required' option in the VBE (VBE - Tools - Options -
Editor - Require Variable Declaration)?

I am using Excel 2000 - fully patched.

Thanks in advance,

Alan.
 
G

Guest

The effect of that setting is to wtite this line in any new modul or class:

Options Explicit

If you delete this line, you will not have to declare your variables.
 
B

Bob Phillips

But why would you? There are no benefits that I know of, and plenty of
disadvantages.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
R

Rob van Gelder

The advantage, of course, is that you can combine it with the POWER of "On
Error Resume Next" and have error free code !


But seriously...
After so many versions of Excel, Require Variable Declaration is still
unticked by default <sigh>.

Working without Option Explicit is begging for trouble.
It really shouldn't be an optional at all.
 
B

Bob Phillips

Rob van Gelder said:
The advantage, of course, is that you can combine it with the POWER of "On
Error Resume Next" and have error free code !

Error free only in the respect that the errors aren't reported!
 
B

Bob Phillips

I know Rob, my point was really re-emphasising to the OP who might have
thought that it would be useful :)

Bob
 

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