3.3.5.2 Reserved Identifiers and IDENTIFIER

 reserved-identifier = statement-keyword / marker-keyword / operator-identifier / 
      special-form / reserved-name / literal-identifier / rem-keyword / 
      reserved-for-implementation-use / future-reserved 
  
 IDENTIFIER = <any lex-identifier that is not a reserved-identifier> 

<reserved-identifier> designates all sequences of characters that conform to <Latin-identifier> but are reserved for special uses within the VBA language. Keyword is an alternative term meaning <reserved-identifier>. When a specific keyword needs to be named in prose sections of this specification the keyword is written using bold emphasis. Like all VBA identifiers, a <reserved-identifier> is case insensitive. A <reserved-identifier> is a token (section 3.3). Any quoted occurrence of one of the <reserved-identifier> elements as a grammar element within the syntactic grammar is a reference to the corresponding token. The token element <IDENTIFIER> is used within the syntactic grammar to specify the occurrence of an identifier that is not a <reserved-identifier>

Static Semantics

  • The name value of an <IDENTIFIER> is the text of its <lex-identifier>.

  • The name value of a <reserved-identifier> token is the text of its <Latin-identifier>.

  • Two name values are the same if they would compare equal using a case insensitive textual comparison.

    <reserved-identifier> are categorized according to their usage by the following rules. Some of them have multiple uses and occur in multiple rules.

    statement-keyword = "Call" / "Case" /"Close" / "Const"/ "Declare" / "DefBool" / "DefByte" / "DefCur" / "DefDate" / "DefDbl" / "DefInt" / "DefLng" / "DefLngLng" / "DefLngPtr" / "DefObj" / "DefSng" / "DefStr" / "DefVar" / "Dim" / "Do" / "Else" / "ElseIf" / "End" / "EndIf" /  "Enum" / "Erase" / "Event" / "Exit" / "For" / "Friend" / "Function" / "Get" / "Global" / "GoSub" / "GoTo" / "If" / "Implements"/ "Input" / "Let" / "Lock" / "Loop" / "LSet" / "Next" / "On" / "Open" / "Option" / "Print" / "Private" / "Public" / "Put" / "RaiseEvent" / "ReDim" / "Resume" / "Return" / "RSet" / "Seek" / "Select" / "Set" / "Static" / "Stop" / "Sub" / "Type" / "Unlock" / "Wend" / "While" / "With" / "Write" 
     
    rem-keyword = "Rem" 
    marker-keyword = "Any" / "As"/ "ByRef" / "ByVal "/"Case" / "Each" / "Else" /"In"/ "New" / "Shared" / "Until" / "WithEvents" / "Write" / "Optional" / "ParamArray" / "Preserve" / "Spc" / "Tab" / "Then" / "To" 
     
    operator-identifier = "AddressOf" / "And" / "Eqv" / "Imp" / "Is" / "Like" / "New" / "Mod" / "Not" / "Or" / "TypeOf" / "Xor" 
    

A <statement-keyword> is a <reserved-identifier> that is the first syntactic item of a statement or declaration. A <marker-keyword> is a <reserved-identifier> that is used as part of the interior syntactic structure of a statement. An <operator-identifier> is a <reserved-identifier> that is used as an operator within expressions.

 

 reserved-name = "Abs" / "CBool" / "CByte" / "CCur" / "CDate" / "CDbl" / "CDec" / "CInt" / "CLng" / "CLngLng" / "CLngPtr" / "CSng" / "CStr" / "CVar" / "CVErr" / "Date" / "Debug" / "DoEvents" / "Fix" / "Int" / "Len" / "LenB" / "Me" / "PSet" / "Scale" / "Sgn" / "String" 
  
 special-form = "Array" / "Circle" / "Input" / "InputB"  / "LBound" / "Scale" / "UBound" 
 reserved-type-identifier = "Boolean" / "Byte" / "Currency" / "Date" / "Double" /  "Integer" / "Long" / "LongLong" / "LongPtr" / "Single" / "String" / "Variant" 
literal-identifier = boolean-literal-identifier / object-literal-identifier / variant-literal-identifier 
boolean-literal-identifier = "true" / "false" 
object-literal-identifier = "nothing" 
variant-literal-identifier = "empty" / "null" 

A <reserved-name> is a <reserved-identifier> that is used within expressions as if it was a normal program defined entity (section 2.2). A <special-form> is a <reserved-identifier> that is used in an expression as if it was a program defined procedure name but which has special syntactic rules for its argument. A <reserved-type-identifier> is used within a declaration to identify the specific declared type (section 2.2) of an entity.

A <literal-identifier> is a <reserved-identifier> that represents a specific distinguished data value (section 2.1). A <boolean-literal-identifier> specifying "true" or "false" has a declared type of Boolean and a data value of True or False, respectively. An <object-literal-identifier> has a declared type of Object and the data value Nothing. A <variant-literal-identifier> specifying "empty" or "null" has a declared type of Variant and the data value Empty or Null, respectively.

 reserved-for-implementation-use = "Attribute" / "LINEINPUT" / "VB_Base" / "VB_Control" / "VB_Creatable" /  "VB_Customizable" / "VB_Description" / "VB_Exposed" / "VB_Ext_KEY " / "VB_GlobalNameSpace" / "VB_HelpID" / "VB_Invoke_Func" / "VB_Invoke_Property " / "VB_Invoke_PropertyPut" / "VB_Invoke_PropertyPutRefVB_MemberFlags" / "VB_Name" / "VB_PredeclaredId" / "VB_ProcData" / "VB_TemplateDerived" / "VB_UserMemId" / "VB_VarDescription" / "VB_VarHelpID" / "VB_VarMemberFlags" / "VB_VarProcData " / "VB_VarUserMemId" 
  
 future-reserved = "CDecl" / "Decimal" / "DefDec" 

A <reserved-for-implementation-use> is a <reserved-identifier> that currently has no defined meaning to the VBA language but is reserved for use by language implementers. A <future-reserved> is a <reserved-identifier> that currently has no defined meaning to the VBA language but is reserved for possible future extensions to the language.