0% found this document useful (0 votes)
90 views2 pages

Built-In Constants: Vbnullchar

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 2

Built-in Constants

Built-in constants are sometimes referred to as intrinsic constants.

VBA.Constants Chr Comments

vbCr Chr(13) Carriage return character

vbLf Chr(10) Linefeed character

vbCrLf Chr(13) + Chr(10) Carriage return - linefeed combination

vbNewLine Chr(13) + Chr(10) New line character

vbNullChar Chr(0) Character having a value of 0.

vbNullString String having value 0 Not the same as a zero-length string (""); used for calling
external procedures.
Cannot be passed to any DLL's

vbTab Chr(9) Tab character

vbBack Chr(8) Backspace character

vbFormFeed Chr(12) Word VBA Manual - manual page break ?

vbVerticalTab Chr(11) Word VBA Manual - manual line break (Shift + Enter)

vbNullChar
This constant can be used to test for a null character.
This can also be used for assigning a null character to a string variable.
The vbNullChar constant can be useful when passing string variables to external libraries that
require a null-terminated string.
This constant should be used instead of Chr(0).

vbNullString
This constant can be used for assigning a zero-length string.
This can also be used to test for empty strings.
For all practical purposes using a zero-length string ("") is equivalent to using vbNullString.
A zero length string means a string with no characters
vbNullString is a constant used for a null-pointer and is more efficient than a zero-length string
The following four lines are all equivalent.

Dim myString As String


myString = ""
myString = vbNullString
myString = Constants.vbNullString
myString = VBA.Constants.vbNullString

You might also like