如何使参数可选?(How to make an argument optional?)
在代码模块(命名功能区)中
Sub Form1Show(control As IRibbonControl) ' this is custom ribbon Form1.Show ' works End Sub在ThisWorkbook模块中:
Private Sub Workbook_Open() Call Form1.Show ' error: argument not optional End Sub有人可以解释一下吗?
In a code Module (named ribbon)
Sub Form1Show(control As IRibbonControl) ' this is custom ribbon Form1.Show ' works End SubIn ThisWorkbook module:
Private Sub Workbook_Open() Call Form1.Show ' error: argument not optional End SubCan somebody explain this?
最满意答案
将参数声明为可选; 否则,它是必需的。
Sub Form1Show(Optional control As IRibbonControl)Declare the parameter as optional; otherwise, it is required.
Sub Form1Show(Optional control As IRibbonControl)更多推荐
发布评论