Space, Space$ Function

See AlsoD4DY92              Example1RQL8TS>Low

Returns a string consisting of a specified number of spaces.

Syntax

Space[$](number)

Remarks

Space returns a Variant8PHEAW3; Space$ returns a String.

The argument number specifies the number of spaces you want in the string.  It can be of any numeric data type3GYXY7 but is rounded to a Long and must be between 0 and approximately 65,535, inclusive.


See Also

Spc FunctionLANSPC

String, String$ Functions1QV50GT


Space, Space$ Function Example

The example uses Space to create a variable containing 10 spaces.  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, Pad, UsrInp                        ' Declare variables.

   UsrInp = InputBox("Enter your first name")  ' Get user input.

   Pad = Space(10)                             ' Create 10-space pad.

   Msg = "Notice the 10-space pad between the first part of this "

   Msg = Msg & "and your name.  " & Pad & UsrInp

   MsgBox Msg                                  ' Display message.

End Sub