gonen
05-01-2011, 10:20 PM
Hello
I create my toolbar using the code below
MacNames(0) = "MoveSelectedUp"
TipText(0) = MacNames(0) + " vbcrlf vbcrlf Move Up Selected rows"
iconnum(0) = 38
MacNames(1) = "MoveSelectedDown"
TipText(1) = MacNames(1) + " vbcrlf vbcrlf Move Down Selected rows "
iconnum(1) = 40
MacNames(2) = "CloneSelected"
TipText(2) = MacNames(2) + " vbcrlf vbcrlf Clone Selected rows"
iconnum(2) = 29
For iCtr = LBound(MacNames) To UBound(MacNames)
tt = TipText(iCtr)
tt = Replace(tt, "vbcrlf", vbCrLf)
With .Controls.add(Type:=msoControlButton)
.OnAction = "'" & ThisWorkbook.Name & "'!" & MacNames(iCtr)
.Style = msoButtonIconAndCaption
.FaceId = iconnum(iCtr)
.TooltipText = tt
End With
Next iCtr
My Questions are:
1 - When I click on a toolbar button - the assigned macro is invoked. Can I invoke a different macro when I right-click on a toolbar button ?
2 - Is there a way to create a menu that will be displayed when I right-click on a toolbar button ? Currently, when I right click any of my toolbar buttons, I get the menu of "Standard Fornmatting..." which is actually as if I clicked on "View >> Toolbars"
Thanks for any help
I create my toolbar using the code below
MacNames(0) = "MoveSelectedUp"
TipText(0) = MacNames(0) + " vbcrlf vbcrlf Move Up Selected rows"
iconnum(0) = 38
MacNames(1) = "MoveSelectedDown"
TipText(1) = MacNames(1) + " vbcrlf vbcrlf Move Down Selected rows "
iconnum(1) = 40
MacNames(2) = "CloneSelected"
TipText(2) = MacNames(2) + " vbcrlf vbcrlf Clone Selected rows"
iconnum(2) = 29
For iCtr = LBound(MacNames) To UBound(MacNames)
tt = TipText(iCtr)
tt = Replace(tt, "vbcrlf", vbCrLf)
With .Controls.add(Type:=msoControlButton)
.OnAction = "'" & ThisWorkbook.Name & "'!" & MacNames(iCtr)
.Style = msoButtonIconAndCaption
.FaceId = iconnum(iCtr)
.TooltipText = tt
End With
Next iCtr
My Questions are:
1 - When I click on a toolbar button - the assigned macro is invoked. Can I invoke a different macro when I right-click on a toolbar button ?
2 - Is there a way to create a menu that will be displayed when I right-click on a toolbar button ? Currently, when I right click any of my toolbar buttons, I get the menu of "Standard Fornmatting..." which is actually as if I clicked on "View >> Toolbars"
Thanks for any help