Constants used in Basic programsBoolean Basic constantsBasic constant;FalseBasic constant;True
Boolean constants
NameTypeValueTrueBoolean1FalseBoolean0
Dim bPositive as BooleanbPositive = TrueBasic Mathematical constantsPi;Basic constantBasic constant;Pi
Mathematical constant
NameTypeValuePiDouble3.14159265358979
Function Rad2Deg( aRad as Double) As Double Rad2Deg = aRad * 180.00 / PiEnd FunctionBasic Object constantsEmpty;Basic constantNull;Basic constantNothing;Basic constantBasic constant;NothingBasic constant;NullBasic constant;Empty
Object Constants
NameTypeUsageEmptyVariantThe Empty value indicates that the variable is not initialized.NullnullIndicates that the variable does not contain data.NothingObjectAssign the Nothing object to a variable to remove a previous assignment.
SubExampleEmpty Dim sVar As Variant sVar = Empty Print IsEmpty(sVar) ' Returns TrueEnd SubSub ExampleNull Dim vVar As Variant MsgBox IsNull(vVar)End SubSub ExampleNothing Dim oDoc As Object Set oDoc = ThisComponent Print oDoc.Title oDoc = Nothing Print oDoc ' ErrorEnd Sub
MsgBox Named Constants
GetAttr Named Constants
VarType Named Constants
Visual Basic constantsVBA Exclusive constants
Additional VBA constants
The following constants are available when VBA compatibility mode is enabledVBA Variable Type Named Constants
Named constantDecimal valuevbArray8192vbBoolean11vbByte17vbCurrency6vbDataObject13vbDate7vbDecimal14vbDouble5vbEmpty0vbError10vbInteger2vbLong3vbNull1vbObject9vbSingle4vbString8vbUserDefinedType36vbVariant12
FormatDateTime VBA Named Constants
StrConv VBA Named Constants
WeekDayName VBA Named Constants
Miscellaneous VBA Named Constants
Named constantHexadecimal (decimal) valueDescriptionvbTrue-1Part of vbTriState enumeration.vbFalse0Part of vbTriState enumeration.vbUseDefault-2Part of vbTriState enumeration.vbCr\x0D (13)CR - Carriage returnvbCrLf\x0D\x0A (13 10)CRLF - Carriage return and line feedvbFormFeed\x0c (12)FF - Form feedvbLf\x0A (10)LF - Line feedvbNewLine\x0D\x0A (13 10) for Windows\x0A (10) for other systemsLF or CRLF vbNullString""Null stringvbTab\x09 (9)HT - Horizontal tabvbVerticalTab \x0B (11)VT - Vertical tab