Ribbbon in Excel XLL

Add-in Express™ Support Service
That's what is more important than anything else

Ribbbon in Excel XLL
Ribbon in XLL AddIn 
Michael Kaden




Posts: 132
Joined: 2017-11-15
Hello,

I want to create a ribbon, at design time in my XLL project. I cannot find anything in the manual. I want to create the ribbon without using a designer, but by writing the appropriate code in:

Ribbon.xml (for the structure/definition of the Ribbon)
Ribbon.vb (Methods like getImage, OnAction etc.)

and add it to the project.

Where do I put:

Protected Overrides Function CreateRibbonExtensibilityObject() As Microsoft.Office.Core.IRibbonExtensibility
Return New Ribbon1()
End Function

I assume I will need

Imports Microsoft.Office.Tools.Ribbon which I cannot find

Any code examples in Visual Basic?

Thank you

regards

Michael
Posted 03 Dec, 2017 09:11:01 Top
Andrei Smolin


Add-in Express team


Posts: 15097
Joined: 2006-05-11
Hello Michael,

Michael Kaden writes:
Imports Microsoft.Office.Tools.Ribbon which I cannot find


It belongs to VSTO; this is why you can find it.

Add-in Express doesn't provide Ribbons in XLL add-ins. We recommend moving the Ribbon UI to a COM add-in so that your application consists of a COM add-in plus XLL add-in combination.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 04 Dec, 2017 03:55:20 Top
Michael Kaden




Posts: 132
Joined: 2017-11-15
Dear Andrei,

Is it correct that to combine ComAddIn and XLL AddIn I add a ComAddIn Project to my Solution?

I have not found any information in the manual how to combine the ComAddIn and the XLL AddIn?

Do you have a sample solution - VB please?

How is the combination published, will the user have to do 2 (ClickOnce) setups?

How Does the XLL AddIn call a function in the ComAddIn?

regards

Michael
Posted 04 Dec, 2017 06:48:26 Top
Andrei Smolin


Add-in Express team


Posts: 15097
Joined: 2006-05-11
Hello Michael,

You add a required Add-in Express module to your project. See http://temp.add-in-express.com/support/comaddin_xll_rtd_vb.zip. This is a recently created VB.NET version of the project I described in HowTo: Create a COM add-in, XLL UDF and RTD server in one assembly.

Michael Kaden writes:
How Does the XLL AddIn call a function in the ComAddIn?


You can access your COM add-in via the following code path:

ExcelApp.COMAddins.Item(strMyComAddinProgId).Object.MyPublicPropertyOrMethod.

1. strMyComAddinProgId - see the ProgId attribute of your add-in module.
2. MyPublicPropertyOrMethod is called via late binding (see System.Type.InvokeMember in MSDN or search through our forums)

Michael Kaden writes:
How is the combination published, will the user have to do 2 (ClickOnce) setups?


This is a single project with a single installer.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 04 Dec, 2017 06:58:51 Top
Michael Kaden




Posts: 132
Joined: 2017-11-15
Dear Andrei,

thank you for the example, it works fine and does what I want.

Please advise:

Is the sample a ComAddIn with the XLL Module added or a XLL AddIn with The AddInModule added?

Where do I find the Ribbon.XML File after I add the Ribbon with the Ribbon Designer

How do I define the position of the Tab, for example if I want it positioned after the Inbuild "TabHome" ?

What does

NOTA BENE. Before you open the project, you need to copy {Add-in Express}\Redistributables\adxloader.dll to {this project}\Loader\ and rename the file to adxloader.comaddin_xll_rtd_cs.dll, replacing the existing file of the same name.


mean for a new project? Do I have to manually copy any file into the Loader Folder of the project?


regards

Michael
Posted 04 Dec, 2017 10:33:09 Top
Dmitry Kostochko


Add-in Express team


Posts: 2742
Joined: 2004-04-05
Hi Michael,

Is the sample a ComAddIn with the XLL Module added or a XLL AddIn with The AddInModule added?


The sample is a COM Add-in with the added XLL Module and RTDServer Module.

Where do I find the Ribbon.XML File after I add the Ribbon with the Ribbon Designer


Add-in Express does not create such a file because special components (ADXRibbonTab) and visual designers are used by Add-in Express for creating the Ribbon UI. You can examine the resulting Ribbon XML created by Add-in Express by handling the OnRibbonBeforeLoad event, for example:


Private Sub AddinModule_OnRibbonBeforeLoad(sender As Object, e As ADXRibbonBeforeLoadEventArgs) Handles MyBase.OnRibbonBeforeLoad

    MessageBox.Show(e.Xml)

End Sub


How do I define the position of the Tab, for example if I want it positioned after the Inbuild "TabHome"?


Add a new ADXRibbonTab component (or select an existing one) to your add-in module designer, set its "InsertAfterIdMso" property to TabHome. Please have a look at the "Positioning Ribbon Controls" (page 138) and "Referring to Built-in Ribbon Controls" (page 137) chapters of the Add-in Express Developers Guide.

What does mean for a new project? Do I have to manually copy any file into the Loader Folder of the project?


This does not relate to a new project created on your machine. Add-in Express creates the Loader folder, copies both adxLoader.dll and adxLoader64.dll and configures them automatically.
Posted 05 Dec, 2017 03:45:40 Top
Michael Kaden




Posts: 132
Joined: 2017-11-15
Thank you Dimitry,

1.) I also got it working now on a new project, but if I create a UDF in the XLL Module - XLL Container and set hidden to true (in the designer), the formula is not hidden but visible in the Formula UI. One reason why I wanted to use an XLL in combination with a ComAddIn is that I can hide my UDF.

2.) Where do I find the OnClick event (onAction) for the Ribbon Buttons?

Regards

Michael
Posted 05 Dec, 2017 05:15:53 Top
Dmitry Kostochko


Add-in Express team


Posts: 2742
Joined: 2004-04-05
Hi Michael,

1. I have just created a new XLL function Test1, added a new ADXExcelFunctionCategory component to XLL Module designer, added a new ADXExcelFunctionDescriptor with FinctionName=Test1 and IsHidden=True. After registering my project, I don't see the Test1 function in the Insert Function dialog in my Excel 2016. Please check the steps/properties on your side. If the issue still persists, please send me your project (or some demo project with the same behavior) for testing.

2. Please select your ADXRibbonTab component in the add-in module designer, then select your ribbon button in the visual designer (see the bottom part of your add-in module designer), switch to the Properties Window and click its Events toolbar button.
Posted 05 Dec, 2017 05:54:23 Top
Michael Kaden




Posts: 132
Joined: 2017-11-15
Hi Dimitry,

thank you very much fro your prompt reply. It all works now s intended.

I am not sure what the problem was.

kind regards

Michael
Posted 05 Dec, 2017 07:59:45 Top
Dmitry Kostochko


Add-in Express team


Posts: 2742
Joined: 2004-04-05
Hi Michael,

Thank you for keeping us informed.
Posted 05 Dec, 2017 08:43:03 Top