ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   runtime Control and code in VBA (https://www.excelbanter.com/excel-programming/287550-runtime-control-code-vba.html)

Anu

runtime Control and code in VBA
 
i want to add runtime command button and want to add click event to this button.

Pls help me out .

Thanx in advance.

Anu

Rob van Gelder[_4_]

runtime Control and code in VBA
 
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" wrote in message
...
i want to add runtime command button and want to add click event to this

button.

Pls help me out .

Thanx in advance.

Anu





All times are GMT +1. The time now is 01:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com