• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

12. Built-in Functions and Statements > 12.3. VBA String Functions

VBA String Functions

Here are a handful of useful functions that apply to strings (both constants and variables):

The Len function

The Len function returns the length of a string, that is, the number of characters in the string. Thus, the code:

Len("January Invoice")

returns the number 15.

The UCase and LCase functions

These functions return an all-uppercase or all-lowercase version of the string argument. The syntax is:

UCase(string)
LCase(string)

For instance:

MsgBox UCase("Donna")

will display the string DONNA.

The Left, Right, and Mid functions

These functions return a portion of a string. In particular:

Left(string, number)

returns the leftmost number characters in string, and:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint