|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
第二种方式:
- Sub AA(ByVal P1 As String, Optional ByVal P2 As String = "(默认参数)")
- MsgBox "你调用了AA过程," & vbCrLf & "参数一:" & P1 & vbCrLf & "参数二:" & P2
- End Sub
- Sub BB(ParamArray varArr())
- Dim I As Long
- Dim strTemp As String
-
- For I = 0 To UBound(varArr)
- strTemp = strTemp & vbCrLf & "第" & I & "个参数值:" & varArr(I) & " [参数类型:" & TypeName(varArr(I)) & "]"
- Next I
-
- I = UBound(varArr) - LBound(varArr) + 1
- MsgBox "你调用了BB过程,并传入了" & I & "个参数!" & strTemp
- End Sub
- Sub Test()
- AA "中国"
- BB "中国", 1, "美国", 1&
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|