Keywords

Keywords are special words that are reserved.
These keywords are used by the compiler to determine the structure of your code.
These are displayed in Blue by default in the Code window.
These cannot be used for variables, or subroutine or function names.

#If(Advanced) Used with conditional compilation arguments.
#Else(Advanced) Used with conditional compilation arguments.
#Else If(Advanced) Used with conditional compilation arguments.
#End If(Advanced) Used with conditional compilation arguments.
#Const(Advanced) Used with conditional compilation arguments.
Alias(Advanced) Used when declaring an external procedure in a DLL that has the same name and something else.
And(Operator) Used as the logical 'AND' operator.
AsUsed when defining the data type of a variable or argument.
BaseUsed when changing the default lower bound of an array, Option Base 1.
Boolean(Data Type) Used to hold either the value True or False.
Byte(Data Type) Used to hold any positive number between 0 and 255.
ByRefUsed to pass variables in and out of subroutines and functions.
ByValUsed to pass variables into subroutines and functions.
CallUsed to allow arguments to be passed in parentheses when execution moves inside a subroutine or function.
CaseUsed with the Select keyword when using conditional branching.
CBool(Data Type Conversion) Used to convert an expression to a Boolean.
CByte(Data Type Conversion) Used to convert an expression to a Byte.
CCur(Data Type Conversion) Used to convert an expression to a Currency.
CDate(Data Type Conversion) Used to convert an expression to a Date.
CDbl(Data Type Conversion) Used to convert an expression to a Double.
CInt(Data Type Conversion) Used to convert an expression to an Integer.
CLng(Data Type Conversion) Used to convert an expression to a Long.
CLngLng(Data Type Conversion) Used to convert an expression to a LongLong.
CLngPtr(Data Type Conversion) Used to convert an expression to a LongPtr.
Compare(Advanced) Used to change the string comparison settings, Option Compare Binary.
ConstUsed to define symbolic constants.
CSng(Data Type Conversion) Used to convert an expression to a Single.
CStr(Data Type Conversion) Used to convert an expression to a String.
Currency(Data Type) Used to hold numbers when you do not want any rounding errors.
CVar(Data Type Conversion) Used to convert an expression to a Variant.
Database(Advanced) Used to change the string comparison settings, Option Compare Database.
DateUsed to define the current system date.
Declare(Advanced) Used when calling windows API functionality.
DefBool(Advanced) Used to define certain variables to have a Boolean data type.
DefByte(Advanced) Used to define certain variables to have a Byte data type.
DefDate(Advanced) Used to define certain variables to have a Date data type.
DefDec(Advanced) Used to define certain variables to have a Variant/Decimal data type.
DefDouble(Advanced) Used to define certain variables to have a Double data type.
DefInt(Advanced) Used to define certain variables to have a Integer data type.
DefLng(Advanced) Used to define certain variables to have a Long data type.
DefLngLng(Added in Office 2010) Used to define certain variables to have a LongLong data type.
DefLngPtr(Added in Office 2010) Used to define certain variables to have a LongPtr data type.
DefObj(Advanced) Used to define certain variables to have a Object data type.
DefSng(Advanced) Used to define certain variables to have a Single data type.
DefStr(Advanced) Used to define certain variables to have a String data type.
DimUsed when declaring one or more variables.
DoUsed with the Until or Loop keywords when repeating one or more statements.
Double(Data Type) Used to hold double precision floating point numbers.
EachUsed with the For keyword to access the individual elements in a collection.
ElseUsed with the If keyword when using conditional branching.
ElseIfUsed with the If keyword when using conditional branching.
EmptyUsed with a Variant data type when a value has not been assigned.
EndUsed to terminate a subroutine, function or property.
EnumUsed to define a user defined enumeration.
Erase(Advanced) Used to reinitialize the elements in an array.
Error(Statement) Used to generate an error message.
Event(Statement) Used to declare a user defined event.
ExitUsed to exit a subroutine or function early before it reaches the end.
ExplicitUsed to force variables to be declared before they can be used, Option Explicit.
FalseUsed to represent the value 0.
ForUsed with the Next keyword when repeating one or more statement.
Friend(Advanced) Used in class modules to prevent subroutines from being accessed from external projects.
FunctionUsed to declare a block of code that can return a value.
Get(Advanced) Used with the Property keyword when creating objects.
GlobalCan be used to declare a Public variable that is visible from all the code modules.
GoToUsed to jump to a line label or reset error handling.
IfUsed with the Then keyword to allow conditional branching.
IIf(Advanced, Function) Used to return one of two values based on the value of an expression.
Implements(Advanced) Used with the Class keyword when creating objects.
IntegerUsed to hold any whole number between -32,768 and 32,767.
IsCompares two object reference variables.
Let(Advanced) Used with the Property keyword when creating objects.
LBound(Advanced, Function) Used to return the lower limit of an array dimension.
Lib(Advanced) Used when calling windows API functionality.
LikeUsed to compare two strings and provide pattern matching.
Long(Data Type) Used to hold any whole number between -2,147,483,648 and 2,147,486,647.
LongLong(Advanced, Data Type) Used to hold large whole numbers on a 64 bit system.
LoopUsed with the Do keyword when repeating one or more statements.
LSet(Advanced, Statement) Used to left align a string within a string variable.
Me(Advanced) Used as an implicitly declared variable inside a class module or userform.
Mod(Operator) Used to divide two numbers and return the remainder.
New(Advanced) Used to create a new instance of an object.
NextUsed with the For keyword when repeating one or more statements.
Not(Operator) Used as the logical 'NOT' operator.
NothingUsed as the default value when an object has not been initialised.
Null(Advanced, Variant) Used to explicitly indicate an invalid value or error.
Object(Data Type) Used to contain a reference (or address) to an actual object.
OnUsed with the Error keyword when using error handling.
OptionUsed to define module level settings.
OptionalUsed to indicate that a variable passed to a subroutine or function is optional.
Or(Operator) Used an the logical 'OR' operator.
ParamArray(Advanced) Used to allow a dynamic number of arguments to be passed to a subroutine or function.
Preserve(Advanced) Used to preserve the items in an array when it is being resized.
PrivateUsed to declare a subroutine that is only visible in that code module.
Property(Advanced) Used with the Class keyword when creating objects.
PublicUsed to declare a subroutine that is visible from all the code modules.
RaiseEvent(Advanced) Used to trigger a class module user defined event.
ReDim(Advanced, Function) Used to initialise or resize an array.
Resume(Advanced) Used with the On Error keywords when using error handling.
Return(Advanced) Used with the GoSub keyword to return execution back to the original line.
RSet(Advanced, Statement) Used to right align a string within a string variable.
SelectUsed with the Case keyword in conjunction with conditional branching.
Set(Advanced) Used with the Property keyword when creating objects.
Single(Data Type) Used to hold single precision floating point numbers.
Static(Advanced, Variables) Used to indicate that a variable will be preserved between calls.
StepUsed with the For keyword to provide additional increments and decrements.
Stop(Advanced) Used to allow you to save a breakpoint in your file.
String(Data Type) Used to hold string variables that are fixed length or variable length.
SubUsed to declare a block of code that does not return a value.
TextUsed to change the string comparison settings, Option Compare Text.
ThenUsed with the If keyword in conjunction with conditional branching.
ToUsed with the For keyword when repeating one or more statements or when declaring a fixed size aaray.
TrueUsed to represent the value -1.
Type(Advanced) Used to define a user defined data structure.
TypeOf(Operator) Used to return the data type of an object.
UBound(Advanced, Function) Used to return the upper limit of an array dimension.
UntilUsed with the Do keyword when repeating one or more statements.
Variant(Data Type) Used to hold any type of data except fixed-length strings and user defined types.
WendUsed with the While keyword when repeating one or more statements.
WhileUsed with the Do keyword when repeating one or more statements.
With(Advanced) Used to perform multiple operations on a single object.
WithEvents(Advanced) Used in class modules to define a variable that can receive events.

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrev