Programmatically switch off "Variable declaration reqiured" in VBE?

  • Thread starter Thread starter Alan
  • Start date Start date
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.
 
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.
 
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)
 
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.
 
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!
 
I know Rob, my point was really re-emphasising to the OP who might have
thought that it would be useful :-)

Bob
 
Back
Top