简体   繁体   English

通过 VBA 传递多个 arguments?

[英]Passing multiple arguments with VBA?

My VBA doesn't work with more than the first parameter.我的 VBA 不能使用超过第一个参数。 Here is my sub header: Sub filterPivotTables(ParamArray argumentsArray() As Variant, sheetName As String,pivotTableName As String,pivotField As String)这是我的子 header: Sub filterPivotTables(ParamArray argumentsArray() As Variant, sheetName As String,pivotTableName As String,pivotField As String)

However, when I change the sub header to this: Sub filterPivotTables(ParamArray argumentsArray() As Variant) it works.但是,当我将子 header 更改为此: Sub filterPivotTables(ParamArray argumentsArray() As Variant)它可以工作。

Is there a reason why I can't pass in more than one parameter?为什么我不能传递多个参数是有原因的吗? How would you pass in more than one parameter?你将如何传递多个参数? Thanks谢谢

ParamArray must be the last argument in the procedure declaration: ParamArray必须是过程声明中的最后一个参数:

Sub filterPivotTables(sheetName As String, pivotTableName As String, pivotField As String, ParamArray argumentsArray() As Variant)

See the docs for a more thorough discussion of ParamArray .有关ParamArray的更全面讨论,请参阅文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM