aravinthaan@yahoo.co.in Posted February 23, 2009 Posted February 23, 2009 Dear All, How to add runtime events for command button in VBA. Dim WithEvents RuntimeCommandButton As CommandButton Private Sub CommandButton1_Click() For i = 0 To 3 Set RuntimeCommandButton = UserForm3.Controls.Add("Forms.CommandButton.1", "RuntimeCommandButton", True) With RuntimeCommandButton '.Left = RuntimeTextBox.Left + RuntimeTextBox.Width + 10 .top = (i * 20) .Width = 30 .Height = 15 .Name = (i * 20) End With Next UserForm3.Show End Sub Private Sub RuntimeCommandButton_Click() MsgBox "hai" End Sub This is my code ,Event will work only last added command button in userform3 control.I want to add events for all runtime added command buttons Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.