String Function

Creates a string according to the specified character, or the first character of a string expression that is passed to the function.

Syntax:


String (n As Long, {expression As Integer | character As String})

Return value:

String

Parameters:

n: Numeric expression that indicates the number of characters to return in the string. The maximum allowed value of n is 2,147,483,648.

Expression: Numeric expression that defines the ASCII code for the character.

Character: Any single character used to build the return string, or any string of which only the first character will be used.

Error codes:

5 Invalid procedure call

Example:


Sub ExampleString
Dim sText As String
    sText = String(10,"A")
    MsgBox sText
    sText = String(10,65)
    MsgBox sText
End Sub

Please support us!