- VBA 教程
- VBA - 主页
- VBA - 概述
- VBA - Excel 宏
- VBA - Excel 术语
- VBA - 宏注释
- VBA - 消息框
- VBA - 输入框
- VBA - 变量
- VBA - 常量
- VBA - 运算符
- VBA - 判断
- VBA - 循环
- VBA - 字符串
- VBA - 日期与时间
- VBA - 数组
- VBA - 函数
- VBA - 子过程
- VBA - 事件
- VBA - 错误处理
- VBA - Excel 对象
- VBA - 文本文件
- VBA - 编程图表
- VBA - 用户表单
- VBA 实用的资源
- VBA - 快速指南
- VBA - 实用的资源
- VBA - 讨论
VBA - Join 函数
一个返回包含数组中指定数量子字符串的字符串的函数。这是 Split 方法的一个完全相反的函数。
语法
Join(List[,delimiter])
参数说明
List − 一个必需的参数。一个包含要连接的子字符串的数组。
Delimiter − 一个可选参数。用作返回字符串的分隔符的字符。默认分隔符是空格。
示例
添加一个按钮并添加以下函数。
Private Sub Constant_demo_Click()
' Join using spaces
a = array("Red","Blue","Yellow")
b = join(a)
msgbox("The value of b " & " is :" & b)
' Join using $
b = join(a,"$")
msgbox("The Join result after using delimiter is : " & b)
End Sub
执行上述函数时,会生成以下输出。
The value of b is :Red Blue Yellow The Join result after using delimiter is : Red$Blue$Yellow
vba_arrays.htm
广告
