我有一个用户表单在单击按钮时在单独的模块中调用宏。我得到以下错误:“运行时错误'450':错误数量的参数或无效的属性分配”从用户表单调用宏时出错
在故障排除中,我删除了参数,并更改了虚拟宏,我打电话不采取参数,但我得到同样的错误。
Public Sub btnSubmit_Click()
Dim Description As String
Dim Priority As String
If (checkCleared.Value = False) Then
MsgBox ("Please certify that all sensitive informationhas been removed and then submit")
Exit Sub
Else
'Description = formScreen.txtDesc.Value
'Priority = formScreen.comboPriority.Value
'Application.Run ThisOutlookSession!postScreenedEmail(Priority, Description)
Application.Run ThisOutlookSession!postScreenedEmail
End If
End Sub
在单独的模块:
Public Sub postScreenedEmail() '(Priority As String, Description As String)
MsgBox ("postScreened")
'MsgBox ("Priority is: " & Priority & " and Description is " & Description)
End Sub
我试图调用宏等的其他方法“呼叫postScreenedEmail()”,但它不能看到宏即可。我的最终目标是抓取用户窗体中的值,并将它们传递给另一个宏,以便它们可以与我正在使用的API一起使用。
编辑:我可能混合了我的术语,这是我正在使用的层次结构(无法与我的代表张贴图片)。话虽这么说,我想只有Application.Run "postScreenedEmail", Priority, Description
做呼叫,它改变了什么
-Project1(VbaProject.OTM)
-Microsoft Outlook Objects
| ThisOutlookSession
-Forms
| formScreen
|
-Modules
Module1
'在单独的模块:'如果它在模块中,为什么使用'ThisOutlookSession'?它不应该是'Application.Run“ModuleName!postScreenedEmail”'? – L42