See Also Example
Returns a string consisting of a specified number of spaces.
Syntax
Space[$](number)
Remarks
Space returns a Variant
The argument number specifies the number of spaces you want in the string. It can be of any numeric data type but is rounded to a Long and must be between 0 and approximately 65,535, inclusive.
Spc Function
String, String$ Functions
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