RSET

RSET stringvar = string

Right aligns a string within a string variable.


stringvarName of the string (String).
stringString expression to be right aligned within the stringvar (String).

REMARKS
* This statement can also be used to copy a variable of one user defined type to another variable of a different user-defined type.
* Left aligns a string within a string variable or copies a variable from one type to another type.
* This statement replaces any left over characters in "stringvar" with spaces.
* If "string" is longer than "stringvar" then only the left most characters up to the length of the "stringvar" are included.
* You can use the LSET statement to left align a string within a string variable.
* The equivalent .NET function is [[Microsoft.VisualBasic.FileSystem.Rset]]
* For the Microsoft documentation refer to learn.microsoft.com

Dim MyString2 As String 
MyString2 = "0123456789" ' Initialize string 10 characters.
Debug.Print VBA.Len(MyString2) ' 10

RSet MyString2 = "shorter" ' MyString contains " shorter".
Debug.Print "'" & MyString2 & "'"

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top