Overwriting dna file on build

66 views
Skip to first unread message

Leo

unread,
Apr 10, 2023, 11:12:13 AM4/10/23
to Excel-DNA
Hi Govert,

I am glad i found your project ExcelDna. I see it has a lot of possibilities.
I am relatively new to programming, and i am learning as i go. I am now rewriting my VBA Excel Addin (.xlam) to vb.net. Which has a lot of UDF in it and a ribbon with some basic custom macros. So i am realy excited with the ExcelDna intellisense. But i now run in a problem with the ribbon using ExcelDna.

I have the ribbon layout marked up in the .dna file, just as in your tutorial on youtube. Now when i build the project it resets the .dna file and deletes everything i added to the .dna file. I added two screenshots of the .dna file which i manipulated and the .dna file after building the project. When i then press CTRL+Z and debug the project, the ribbon is still showing in Excel. But the ribbon won't show when i load the xll in Excel. Can you help me with my problem?

Also another question: in your tutorial you said it is possible to reference athe ribbon xml file from the dna file. But i cannot find the correct syntax for the reference to the external xml file. Can you tell me how to do that?

2023-04-10 16_58_36-W2NExcelAddin.png2023-04-10 16_58_54-W2NExcelAddin.png

Kedar Kulkarni

unread,
Apr 10, 2023, 1:04:15 PM4/10/23
to Excel-DNA
Hi Leo,


You can store the ribbon however you want (a raw text file, embedded resource.) You need to create a class that extends  ExcelRibbon  class and override the GetCustomUI() and return a string which is a wellformed excel ribbon xml.

public class RibbonController : ExcelRibbon
    {
        public override string GetCustomUI(string RibbonID)
        {
         // return wellformed ribbon xml - from a embedded resource / local file etc.
Reply all
Reply to author
Forward
0 new messages