Functions $

Some of the VBA string functions have two forms.
One that returns a String data type and one that returns a String-Variant data type.
The names of the functions that return a string include a dollar sign ($).
The following table lists all the functions that return a string data type.
The String returning functions are faster; however you will get an error if you call them with a value that is Null.
The functions that return a string-type variant can handle Null values without an error.


FunctionComments
CHR$Returns the character with the corresponding ANSI number (String).
CHRB$Returns the character with the corresponding ANSI number (String).
CHRW$Returns the character with the corresponding ANSI number (String).
COMMAND$Returns the argument portion of the command line used to launch the application (Variant).
DIR$Returns the name of a file or directory matching a pattern or attribute (String).
ENVIRON$Returns information about the current operating system environment (String).
FORMAT$Returns the text string of a number or date in a particular format (String).
LCASE$Returns the text string with all characters converted to lowercase (String).
LEFT$Returns a number of characters from the left of a string (String).
LEFTB$Returns a number of characters from the left of a string (String).
LTRIM$Returns the text string without leading spaces (String).
MID$Returns the text string which is a substring of a larger string (String).
MIDB$Returns the text string which is a substring of a larger string (String).
OCT$Returns the number converted to octal (Variant).
RIGHT$Returns the number of characters from the right of a text string (String).
RIGHTB$Returns the number of characters from the right of a text string (String).
RTRIM$Returns the text string without trailing spaces (String).
SPACE$Returns the specified number of spaces (String).
STRING$Returns a repeating character of a given length (String).
TRIM$Returns the text string removing leading and trailing spaces (String).
UCASE$Returns the text string with all the characters converted to uppercase (String).

© 2017 Better Solutions Limited. All Rights Reserved. © 2017 Better Solutions Limited

Top

PrevNext