Menu add-in

P

Peter

Dear all brains,

I have already written an add-in that creates a menu called "Zenos"
however I am having some serious trouble adding menu items to that
menu by another add-in.

This is the code, if anyone has any ideas please let me know:

Dim tns As Object

Set tns = CommandBars("Worksheet Menu Bar").Controls("Zenos")
With tns
.Controls.Add(Type:=msoControlButton).Caption = "Daily Payments
Monitoring"
.Controls("Daily Payments Monitoring").OnAction = "TNS_report"
End With

Thanks,
Peter
 
P

Peter

Dear all brains,

I have already written an add-in that creates a menu called "Zenos"
however I am having some serious trouble adding menu items to that
menu by another add-in.

This is the code, if anyone has any ideas please let me know:

Dim tns As Object

Set tns = CommandBars("Worksheet Menu Bar").Controls("Zenos")
With tns
.Controls.Add(Type:=msoControlButton).Caption = "Daily Payments
Monitoring"
.Controls("Daily Payments Monitoring").OnAction = "TNS_report"
End With

Thanks,
Peter

Don't worry trying to work this out, here is the answer:

Sub menuItem_Create()
With CommandBars("Worksheet menu bar").Controls("Zenos")
.Controls.Add(Type:=msoControlButton).Caption = "Peter"
.Controls("Peter").OnAction = "peter"
.Controls("Peter").FaceId = 285
End With
End Sub
Sub peter()

MsgBox "Peter"
End Sub

Sub delete_peter()
Dim myCmd As Object
Set myCmd = CommandBars("Worksheet menu bar").Controls("Zenos")
myCmd.Controls("Peter").Delete
End Sub
 

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