disable a button if no active workbook

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hoadiem
    New Member
    • Mar 2013
    • 5

    #1

    disable a button if no active workbook

    Hi, all

    I am doing a custom excel addin in vsto , i want to be able to disable buttons in the ribbon (in my excel addin) if no active workbook open.
    just like when you close out all workbook , you will see all the build-in buttons from excel are greyed out except a few still enable.

    is it possible to do it ?

    some thing like this ? I'm using C#

    Code:
    addin on load event ()
    {
    if (Excel.Workbook wb == null) // this code is wrong
    {
         button.Enabled = false;
    }
    else
    {
         button.Enabled = true;
    }
    }
    thank you
Working...