- 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
廣告
