Space関数

指定された数のスペースで構成される文字列を戻します。

構文

Space(number)

備考

number引数は、文字列に含めるスペースの数です。

次の例では、Space関数を使用して、指定した数のスペースで構成される文字列を戻します:

:

Dim MyString
MyString = Space (10)   ' Returns a string with 10 spaces.
MyString = "Hello" & Space (10) & "World" 
' Insert 10 spaces between two strings.
MyString = "Name:" & Space (5) & "John Doe"   
' Adds 5 spaces between "Name:" and "John Doe"
MyString = "Start" & Space (0) & "End"   
' No spaces added between "Start" and "End"