0

我正在研究 Infopath 和 VBA 并面临一个微不足道的问题。我曾尝试对此进行搜索并找到了一些示例,但无法正确理解它们(作为新手)。

如果有人能把我推向正确的方向,我将不胜感激。

我试图通过单击一个名为 MasterSumbit 的按钮来完成四个按钮(button1、2、3、4)的执行代码

我在 InternalStartup 部分加载了事件处理程序

    Private Sub InternalStartup(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Startup
    AddHandler DirectCast(EventManager.ControlEvents("Button1"), ButtonEvent).Clicked, AddressOf Button1_Clicked
    AddHandler DirectCast(EventManager.ControlEvents("Button2"), ButtonEvent).Clicked, AddressOf Button2_Clicked
    ...and such for button 3 and 4
    AddHandler DirectCast(EventManager.ControlEvents("MasterSubmit"), ButtonEvent).Clicked, AddressOf MasterSubmit_Clicked
    End Sub

这是 MasterSubmit 按钮上单击事件的代码

    Public Sub MasterSubmit_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)

    Button1_Clicked.click()
    Button2_Clicked.click()
    Button3_Clicked.click()
    Button4_Clicked.click()

    End Sub

我收到每个按钮的以下错误

Argument not specified for parameter 'e' of 'Public Sub Button1_Clicked(sender As Object, e As Microsoft.Office.InfoPath.ClickedEventArgs)'.
Argument not specified for parameter 'sender' of 'Public Sub Button1_Clicked(sender As Object, e As Microsoft.Office.InfoPath.ClickedEventArgs)'.

感谢期待

4

2 回答 2

1

尝试这个:

Public Sub MasterSubmit_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)

 Button1_Clicked.click(sender, e)
 Button2_Clicked.click(sender, e)
 Button3_Clicked.click(sender, e)
 Button4_Clicked.click(sender, e)

End Sub
于 2013-03-24T11:31:00.463 回答
0

(在 Sub for Master 按钮内)这不起作用吗?

Button2.PerformClick()
Button3.PerformClick() etc....

希望我有所帮助。

于 2013-03-26T02:16:48.393 回答