Home » Windows OSRSS

Excel 2007: Add-in button under View menu is disabled.

Hi all, Can someone help me with this:

Under Excel 2007 I have an Add-in that is a task pane. when i closed my add-in I cannot open it back. I usually go to View menu and i see a button to open my add-in and it is disabled... To make it enabled i have to go to Review menu and "Unprotect sheet". That is something that i do not want to do.

Can you help me or let me know were i can find help about that?

Thank you in advance

Regards

Sebastian.

 

7 Answers Found

 

Answer 1

Hello Sebastian,

Thanks for posting! I read your post carefully, but I think your question is unclear for me so that currently I cannot give much helpful information on this. To provide further assistance, would you mind clarifying some points?

What’s button  in the view  ribbon tab you are referring to? Is it a system built-in button or a button you create in your AddIn?

If it is a system built-in button, could you please let us know its name, so we can do further investigation from our side to help.

If it is a button you create, I do not see how its enable status is related to “unprotect the sheet”. I believe it should be related to how you implement this button. So, to give more help on this, could you please clarify the following points,

What addin you are developing? How do you create the button in the View ribbon? Are you implementing the GetEnable callback for the customer button?

As to the question 2 and 3, posting your codes or sharing your project would be welcome.

FYI, here are some general articles about how to create customer task pane. Wish they also help you.

Custom Task Panes Overview: http://msdn.microsoft.com/en-us/library/aa942864.aspx.
How to: Add a Custom Task Pane to an Application:http://msdn.microsoft.com/en-us/library/aa942846.aspx

We are looking forward to you reply. Have a nice day!

Best regards,
Bessie Zhao - MSFT
MSDN Subscriber Support in Forum
If you have any feedback of our support, please contact msdnmg@microsoft.com.

 

Answer 2

Hello Bessie Zhao,

Thank you very much for your answer! sorry that i was not to clear....

We are developing an Excel 2007 Application Add-In in C#.

It adds a control in Excel’s “Document Actions” (ActionsPane.Controls.Add).

Since the woksheet is protected, we cannot use the system built-in button  “View -> Document Actions” to open the Task Pane (Document Actions) if it is closed, except that we unprotect the worksheet.

Thank you in advance if you have some way to avoid that this button became disabled.

Regards

Sebastian.

 

Answer 3

Hello again Sebastian,

Thanks for the further information. Now I could get better understanding on this question. Unfortunately, as far as I know, there is no a direct way to change the behavior of built-in buttons. As a kindly reminder, I think you are working with a document-level project. J

As an alternative way, I think you could create a button  in this add-in. In the click event hander of this button, unprotect this worksheet and make this action pane visible. As a kindly reminder, I think you are working with a document-level project. You could refer to the following steps:

Add an item (Ribbon Designer), and drag/drop a button on this ribbon. In the click event hander of this button, write lines as below.
                object missing=Type.Missing;
                Globals.Sheet1.Unprotect(missing);
                Globals.ThisWorkbook.Application.CommandBars["Task Pane"].Visible = true;
                Globals.Sheet1.Protect(missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);

Here is also a general article introduce how to add actions pane to Excel workbook which might help you.

How to: Add an Actions Pane to Excel Workbooks: http://msdn.microsoft.com/en-us/library/e3zbk0hz.aspx.
Actions Pane Overview: http://msdn.microsoft.com/en-us/library/7we49he1(VS.90).aspx.
               
If you have any concern for this post, just feel free to follow up.

Best regards,
Bessie Zhao - MSFT
MSDN Subscriber Support in Forum
If you have any feedback of our support, please contact msdnmg@microsoft.com


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
 

Answer 4

Hello Bessie Zhao,

 

Thank you very much for the answer ....

Well yes, we are working with a document-level project... and we have review some of the option that you are talking about!

The point in here is why Document Actions button  is disabled  if your worksheet is protected...

Here is where we want to make focus... we need to have this document action button enabled in a protected worksheet.

How we could do that?

 

Thank you in advance,

Regards

 

Sebastian :)

 

Answer 5

Hello again Sebstian,

When we protect an worksheet by clicking Protect Sheet button  on Changes group of Review tab,  it will disable any controls concerning changes on tab. For more detailed information, we could refer to this article on Microsoft Online: Protect worksheet or workbook elements. Although it does not explicitly point out those controls which are disabled, excel also will disable those buttons concerning customization. Document Actions button is designed to work so. Unfortunately, there is no a way to change the behavior of built-in buttons. Sorry for any inconveniences it brings to you.

So here, my suggestion is to create a custom button. Then in this button click event hander, write some lines to unprotect this worksheet and make this action pane visible. This way might be not the perfect one you are looking for. If you have any concern for this method, or any further help is needed on this method, just feel free to let me know.

Best regards,
Bessie

 

Answer 6

Hello Bessie,

 

Thank you very much for your soon answer....

Well, we do not wish to unprotect the worksheets. We need other alternative... perhaps add a new button  under View menu  named "Toggle Taskpane" for instance... but not so sure if we can do that and if the sheet protection stuff can affect this button too keeping it disabled  as we have right now the document action stuff.

Keep in mind that unprotect is not an option for us.

We also had try adding a new group menu in the ribbon called "Add-in" and inside here we have a button "Toggle Taskpane" but it is not working so fine... because when you open a new blank workbook from the already opened workbook... both ribbon seems to syncronize and sometimes the add-in  menu disappear... it is really odd...

Perhaps a new button under View menu should be fine but we want to warranty it will be enabled even if the worksheet is protected.

Can you suggest another stuff?

Thank you in advance for your help.

 

Regards

 

Sebastian

 

Answer 7

Oh, sorry, I have missed the point that unprotecting worksheet is not an option for you. I just test the method you are talking about. Yes, you are correct, and we could create a custom button  for this objective without unprotecting this worksheet. This custom button will not be disabled  along with clicking Protect Worksheet button.

When using Ribbon Designer/Ribbon XML to add a button on tab, By default, this custom button will be in the Add-ins tab. However, if we want to add this button to other built-in tab, here is a thing which would help you. Since it is impossible to add a button to an built-in group, we could add this button on a custom group, and put this group on the View tab. For more information, you could see this MSDN page: http://msdn.microsoft.com/en-us/library/bb386097.aspx. If there is any help I could provide in my side, just feel free to let me know.

For the problem you are seeing when open a new blank workbook, it is because that this project you create a new button is a document-level one. The document-level project is for a special workbook not all workbooks. So this customization is only available for current workbook. When you open a new blank workbook from it, it works as expected, and this customization is not available for this new blank workbook. 

Here is a thread about the differences between document-level customizations and application-level add-ins: http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f02831c0-4e26-471f-8736-6a24473422e1/. The application-level add-ins are for all documents. If we want to make the custom button for all workbooks, the only way is to create an application-level add-in. However, if so, the thing will be different. In an add-in, we could create an custom task pane instead of an actions pane. However, custom task pane is not related to Document Actions button. For more information concerning custom tasks pane, please see this MSDN page: http://msdn.microsoft.com/en-us/library/aa942864.aspx.

Best regards,
Bessie Zhao - MSFT
MSDN Subscriber Support in Forum
If you have any feedback of our support, please contact msdnmg@microsoft.com

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter