See Also Example
Right aligns a string within the space of a string variable.
Syntax
RSet stringvar = stringexpr
Remarks
The RSet statement has these parts:
Part Description
stringvar Name of a String variable.
stringexpr String expression to be right aligned within stringvar.
If stringexpr is shorter than stringvar, RSet right aligns stringexpr within stringvar. RSet replaces any leftover characters in stringvar with spaces, back to its beginning.
If stringexpr is longer than stringvar, RSet places only the leftmost characters, up to the length of stringvar, in stringvar. Characters beyond the length of stringvar are truncated from the right.
You can't use RSet to assign variables of one user-defined type to those of another.
LSet Statement
The example uses RSet to right align text in a 40-character String variable). To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Dim Msg, NL, OldFont, TmpStr ' Declare variables.
NL = Chr(10) ' Define newline.
OldFont = FontName ' Save old font.
FontName = "Courier" ' Use monospaced font.
TmpStr = String(40, "*") ' Create 40-character string.
Msg = "Here are two strings that have been right"
Msg = Msg & NL & "and left justified in a " & Len(TmpStr)
Msg = Msg & "-character string." & NL & TmpStr & NL
RSet TmpStr = "Right->" ' Right justify.
Msg = Msg & TmpStr & NL
LSet TmpStr = "<-Left" ' Left justify.
Msg = Msg & TmpStr & NL
Print Msg ' Display message.
FontName = OldFont ' Restore original font.
End Sub