首页  >  Word

替自定义函数设置不定个数的参数

Word 2024-04-15 10:00:14 31

本文为随书问题参考答案

以下过程供参考:

Function JoinText(Txt As String, ParamArray list() As Variant) As String
Dim c As Variant, v As Variant
For Each c In list
If TypeName(c) = "Range" Or TypeName(c) = "Variant()" Then
For Each v In c
JoinText = JoinText & v & Txt
Next v
Else
JoinText = JoinText & c & Txt
End If
Next c
JoinText = Left(JoinText, Len(JoinText) - 1)
End Function

VBA
版权声明

本文来自投稿,不代表本站立场,转载请注明出处。

分享:

扫一扫在手机阅读、分享本文