problems adding botton to a menu bar

F

filo666

Hello, I created an add in with a userform, I want to create a button that
opens the userform when clicked, in order to doing so I have until now in my
add in workbook:

Private Sub Workbook_AddinInstall()
Application.CommandBars("Formatting").Controls.Add
Type:=msoControlButton,
ID:=2950, Before:=13
End Sub

but I do not know how to assign the macro to the button; the macro writen in
the add in does not appear in the macro dialog box.

thanks
 
B

Bob Phillips

Private Sub Workbook_AddinInstall()
With Application.CommandBars("Formatting").Controls.Add( _
Type:=msoControlButton, ID:=2950, Before:=13)

.OnAction = "Test"
End With
End Sub
 
F

filo666

Thnaks, It worked perfectly;

other question,
How to add a different image to the macro button??
How to change the button description?
 

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