Space 函数Space function

返回由指定的空格数量构成的“变量”****(“字符串”****)。Returns a Variant (String) consisting of the specified number of spaces.



必需的_number_ 参数是要在字符串中留出的空格数。The required number argument is the number of spaces you want in the string.


“空格”**** 函数有助于格式化输出和清除固定长度字符串中的数据。The Space function is useful for formatting output and clearing data in fixed-length strings.


此示例使用了“空格”**** 函数返回由指定的空格数量构成的字符串。This example uses the Space function to return a string consisting of a specified number of spaces.

Dim MyString
' Returns a string with 10 spaces.
MyString = Space(10)

' Insert 10 spaces between two strings.
MyString = "Hello" & Space(10) & "World"

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.