Disable custom ribbon tab button from Excel task pane?

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

Disable custom ribbon tab button from Excel task pane?
 
erosal




Posts: 16
Joined: 2013-09-09
I'm writing an add-in that allows a user to open a Excel document from our back-end database, edit it, then write the updated document back to the database. I have an ADXRibbonTab with custom "Open" and "Save" ADXRibbonButton objects. Clicking the "Open" button shows an ADXExcelTaskPane from which the user navigates to the desired document.

Once a document is open, I want to disable the "Open" ADXRibbonButton. How would I go about doing this?

Thanks!

-- Tony
Posted 28 Jul, 2015 10:59:27 Top
nwein




Posts: 577
Joined: 2011-03-28
Just set the Enabled property of the ADXRibbonButton to false once the document is loaded.
MyADXRibbonButton.Enabled = false;
Posted 28 Jul, 2015 11:16:42 Top
erosal




Posts: 16
Joined: 2013-09-09
Unfortunately, MyADXRibbonButton isn't in scope in the task pane. How do I locate a child control of a different parent?
Posted 28 Jul, 2015 15:30:51 Top
nwein




Posts: 577
Joined: 2011-03-28
You can either change the button's modifier to be more accessible (protected, public), or expose it through a public property.
You can always reference your ADXAddinModule from anywhere either as a static object or get the instance by using MyADXAddinModule.CurrentInstance, then you can get any public/protected member of the class without a problem.
Posted 28 Jul, 2015 17:12:50 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Thank you Nir!

Hello Tony,

An example would be MyAddin1.Addinmodule.CurrentInstance.MyProperty = true.


Andrei Smolin
Add-in Express Team Leader
Posted 29 Jul, 2015 02:36:03 Top
erosal




Posts: 16
Joined: 2013-09-09
That did the trick -- thanks, everyone!
Posted 29 Jul, 2015 07:14:04 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Welcome!


Andrei Smolin
Add-in Express Team Leader
Posted 29 Jul, 2015 07:16:05 Top