Space and Spc Functions

傳回一個由指定數量的空格組成的字串。

note

The Spc function works the same as the Space function.


Syntax:

Space (n As Long)

Spc (n As Long)

Return value:

字串型

Parameters:

n: Numeric expression that defines the number of spaces in the string. The maximum allowed value of n is 2,147,483,648.

錯誤代碼:

5 無效的程序呼叫

Example:


Sub ExampleSpace
Dim sText As String, sOut As String
Dim iLen As Integer
    iLen = 10
    sText = "Las Vegas"
    sOut = sText & Space(iLen) & sText & Chr(13) &_
    sText & Space(iLen*2) & sText & Chr(13) &_
    sText & Space(iLen*4) & sText & Chr(13)
    msgBox sOut,0,"Info:"
End Sub

Please support us!