Custom Menus

B

Barkingmadscot

I never done this i am having problem with get my buttons to run a
sub/function i have. See code below. I can create the menu, i can add

the action on click

I have tried .onaction = run("myfuc"), but runs my fucntion as the menu

is created.


Can some point me in the right direction please


***************************************************************************­***



Set cb = CommandBars.Add(Name:="Engineering", Position:=msoBarTop,
Temporary:=True)


With cb
Set ctlBut1 = cb.Controls.Add(msoControlButton, ID:=1)
Set ctlBut2 = cb.Controls.Add(msoControlButton, ID:=2)
.Visible = True
End With


With ctlBut1
.Caption = "Enable"
.Style = msoButtonCaption
End With


With ctlBut2
.Caption = "Disable"
.Style = msoButtonCaption
End With


***************************************************************************­*****
 
B

Barkingmadscot

Barkingmadscot said:
I never done this i am having problem with get my buttons to run a
sub/function i have. See code below. I can create the menu, i can add

the action on click

I have tried .onaction = run("myfuc"), but runs my fucntion as the menu

is created.


Can some point me in the right direction please


***************************************************************************­***



Set cb = CommandBars.Add(Name:="Engineering", Position:=msoBarTop,
Temporary:=True)


With cb
Set ctlBut1 = cb.Controls.Add(msoControlButton, ID:=1)
Set ctlBut2 = cb.Controls.Add(msoControlButton, ID:=2)
.Visible = True
End With


With ctlBut1
.Caption = "Enable"
.Style = msoButtonCaption
End With


With ctlBut2
.Caption = "Disable"
.Style = msoButtonCaption
End With


***************************************************************************­*****


Its okay silly me it should be .Onaction = "myfuc" without the run

:)
 

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