HOW CAN I WRITE A CODE TO A COMMANDBUTTON CREATED PROGRAMMATICALLY

K

Kozete

My first question is how can I write a code to A CommandButton added by the
code below.

Private Sub Workbook_Open()

Set MyCommandButton = UserForm1.Controls.Add
("Forms.CommandButton.1", "CommandButton1" )

End Sub


My second question is, is there a way to create a UserForm programmatically?
(As my project above, I had to create a UserForm manually first and then
invoked the code above to add a CommandButton to my UserForm.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top