G Guest Jan 12, 2004 #1 i want to add runtime command button and want to add click event to this button. Pls help me out . Thanx in advance. Anu
i want to add runtime command button and want to add click event to this button. Pls help me out . Thanx in advance. Anu
R Rob van Gelder Jan 12, 2004 #2 Anu, This goes into a userform: Public WithEvents cmdButton As MSForms.CommandButton Sub testit() Set cmdButton = Me.Controls.Add("Forms.CommandButton.1", "cmdMyButton") cmdButton.Caption = "Click Me" End Sub Private Sub cmdButton_Click() MsgBox "Hello" End Sub Rob
Anu, This goes into a userform: Public WithEvents cmdButton As MSForms.CommandButton Sub testit() Set cmdButton = Me.Controls.Add("Forms.CommandButton.1", "cmdMyButton") cmdButton.Caption = "Click Me" End Sub Private Sub cmdButton_Click() MsgBox "Hello" End Sub Rob