Help with formatting right-click menu caption.

Darren Bartrup

Well-known Member
Joined
Mar 13, 2006
Messages
1,297
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'm not even sure this is possible, but if it is then I'm hoping someone can give me the answer.

I've created a spreadsheet which has a dynamic right-click menu which changes to show the breakdown of overall figures in specific cells in my workbook.

A highly simplified example of the code used to add the caption is:
Code:
Public Sub BuildMenu()

    Dim objCmdBarCtrl   As CommandBarControl
    Dim objCmdButton    As CommandBarButton
    
    Set objCmdBarCtrl = Application.CommandBars("Cell").Controls.Add _
                        (Type:=msoControlPopup, Before:=1)
    objCmdBarCtrl.Caption = "Figures for December 2005"
    objCmdBarCtrl.Tag = "Scorecard"
    
    Set objCmdButton = objCmdBarCtrl.Controls.Add
    objCmdButton.Caption = "Specialism - 18 / Target - 15"
    
End Sub

What I'd like to be able to do is show the figures (18 and 15) in bold on the menu and possibly have the 18 figure in red if it's under the target and green if it's over target.

Forgot to add in my original post that I'm using Excel 2002.

Any help would be greatly appreciated & many thanks in advance.

Update: I've had a reply saying that though I can change the buttons and case of the text, I can't change the colours etc.
As the colour is changed when a option is disabled (greyed out) I might be able to do it using the API.... anyone know anything about API's?

Delmar
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,215,348
Messages
6,124,423
Members
449,157
Latest member
mytux

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top