Name
Space Function
Syntax
Space(number
)
-
number
Use: Required
Data Subtype: Integer
An expression evaluating to the number of spaces required.
Return Value
A Variant of subtype String containing
number
spaces.
Description
Creates a string containing number
spaces.
Rules at a Glance
While
number
can be zero (in which case the function returns a null string), runtime error 5, “Invalid procedure call or argument,” is generated ifnumber
is negative.Space
is a “convenience function” that is equivalent to the function call:sString = String(number, 32)
VBA/VBScript Differences
VBScript doesn’t support the VBA String$
function, which returns a string rather than a variant of subtype
string.
Get VBScript in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.