我正在研究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按钮上的click事件的代码
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)'.
感谢您的期待
答案 0 :(得分: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
答案 1 :(得分:0)
(在Sub for Master按钮内)这不起作用吗?
Button2.PerformClick()
Button3.PerformClick() etc....
希望我帮助过。