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.26k stars 270 forks source link

How to access Microsoft.Office.Interop.Excel component from IRibbonControl #674

Closed emphasis87 closed 3 months ago

emphasis87 commented 4 months ago

Assuming it is possible, can I get a reference to Microsoft.Office.Interop.Excel.EditBox from IRibbonControl (not sure they are related) in getEnabled handler? I am trying to set EditBox PasswordEdit property or otherwise solve password input without it being visible.

Thanks in advance for help!

govert commented 4 months ago

The ribbon is not related to those control classes in the interop assembly. For the ribbon you only have the xml definition you provide, and then the callbacks you declare in the xml. So, for an editBox in a ribbon you can only set these attributes and callbacks: https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2007/aa338199(v=office.12)#editbox

I think you'd probably have to pop up a dialog (like a Windows Forms dialog you create) to get the password entered.

emphasis87 commented 3 months ago

I went with the popup option.