使用参数抛出语法错误调用其他子

时间:2019-04-13 14:53:36

标签: excel vba

使用两个参数调用其他子程序时,出现语法错误。

UpdatingActiveWorkbook(workBookPath,13)-突出显示为语法错误。

Sub UpdatingActiveWorkbook(workBookPath As String, workbookname As Integer)


Workbooks.Open workBookPath

Workbooks("MacroWorkbook.xlsm").Activate
Workbooks(workbookname).Activate


ActiveWorkbook.Close

End Sub

Sub callingOtherModule()


UpdatingActiveWorkbook("C:\334804_PF_Calculation6.xls",13)



End Sub

1 个答案:

答案 0 :(得分:1)

要么:

1)使用(过时的)Call关键字

然后可以保留括号:

    Call UpdatingActiveWorkbook("C:\334804_PF_Calculation6.xls", 13)

2)或删除括号:

    UpdatingActiveWorkbook "C:\334804_PF_Calculation6.xls", 13