Results 1 to 5 of 5

Thread: Option Explicit

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    What does 'Option Explicit' do anyway?

  2. #2
    Lively Member
    Join Date
    Sep 2000
    Posts
    126

    Variable

    It makes it so you have to declare a variable to be able to use it...

  3. #3
    Guest
    VB's definition:

    [/quote]

    Used at module level to force explicit declaration of all variables in that module.

    Syntax

    Option Explicit

    Remarks

    If used, the Option Explicit statement must appear in a module before any statements that declare variables or define constants.
    If you don't use the Option Explicit statement, all undeclared variables are of Variant type unless the default type is otherwise specified with a Deftype statement.
    When you use the Option Explicit statement, you must explicitly declare all variables using the Dim, Private, Public, ReDim, or Static statements. If you attempt to use an undeclared variable name, an error occurs at compile time.

    Tip Use Option Explicit to avoid incorrectly typing the name of an existing variable or to avoid risking confusion in code where the scope of the variable is not clear.

    [/quote]

  4. #4
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    And if i catch anyone not using Option Explicit i will personally come round to your house and slap you around till you swear on your life that you will always use it from that day on
    Iain, thats with an i by the way!

  5. #5
    Guest
    Not using Option Explicit is actually SOMETIMES helpful, for if you kept on forgetting to dim something, OE can give you a hard time.

    Hey, why is Option Explicit so Popular? Why not Option Compare or Option Base?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width