[AccessD] Option Explicit Statement

MartyConnelly martyconnelly at shaw.ca
Fri Jan 19 13:17:18 CST 2007


Yup. You must explicitly declare all variables using the Dim, Private,
Public, or ReDim statements but with no AS type extension.

Doing the statement below speeds up vbscript

<script language="VBScript">
  option explicit
  on error resume next

Declaring a variable creates a specific namespace for it, which allows
the code to use the variable easily once the code is compiled to
byte-code.  The opposite (not declaring variables) results in the
compiled bytecode having to search through "variable tables" for the
actual name of the variable in order to find the memory address of the
contents of the variable.  For example it doesn't have to search for or
differentiate between a local and global variable.

I am not sure if this speeds up VBA code but it could

Gustav Brock wrote:

>Hi Marty
>
>But isn't that because you can only declare the variables as Variant in VBScript?
>
>/gustav
>
>  
>
>>>>martyconnelly at shaw.ca 19-01-2007 19:35:35 >>>
>>>>        
>>>>
>
>.. Go and look at how many VBScripts on web pages skip this option
>
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada




More information about the AccessD mailing list