O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Space Function

Syntax

Space(number)
number

Use: Required

Data Type: Integer

An expression evaluating to the number of spaces required.

Return Value

A 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 empty string), runtime error 5, “Invalid procedure call or argument,” is generated if number 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 Space$ function.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required