Excel-DNA / ExcelDna

Excel-DNA - Free and easy .NET for Excel. This repository contains the core Excel-DNA library.
https://excel-dna.net
zlib License
1.28k stars 274 forks source link

Is it possible to change the menu text dynamically? #562

Open rdejournett opened 1 year ago

rdejournett commented 1 year ago

For example I have the menu like this:

<ExcelCommand(MenuName:="RoadTrip", MenuText:="----" & " v14.4.0 " & "------")>
Public Shared Sub DoNothing()
End Sub

Is there something in the code I can use to change the MenuText property? The user wants to return a number based on what the code is doing (it's driving a motor and they want to use it to return the position of the motor).

govert commented 1 year ago

I would suggest changing to use the Ribbon interface for the menus. This is a good start: https://github.com/Excel-DNA/Samples/tree/master/Ribbon

For updating the ribbon, you might like to look at this discussion and code snippets: https://groups.google.com/g/exceldna/c/5cklJD9Wm_4/m/K6KcVf3PEwAJ

govert commented 1 year ago

Here's a VB.NET version of the Ribbon tutorial: https://github.com/Excel-DNA/Tutorials/tree/master/Fundamentals/RibbonBasics

rdejournett commented 1 year ago

Thank you!

augustoproiete commented 1 year ago

You might also be interested in the dynamicMenu control: https://stackoverflow.com/a/34033472