Archive for the ‘VSTO’ Category

VSTO Action Pane Closing

When creating VSTO documents that use an Action Pane, the Action Pane gets “lost” if you open another non-VSTO document. The Action Pane is hidden by the different document (as it should), but when you switch back to the original VSTO document, the Action Pane does not automatically re-open itself. This can be fixed by handling the ThisWorkbook_WindowActivate event. In this event we can check the state of the Actions Pane and re-display it if necessary:

private void ThisWorkbook_WindowActivate(Microsoft.Office.Interop.Excel.Window Wn)
{
    if (!Globals.ThisWorkbook.ActionsPane.Visible)
    {
        Globals.ThisWorkbook.ActionsPane.Visible = true;
    }

    if (!ThisApplication.DisplayDocumentActionTaskPane)
    {
        ThisApplication.DisplayDocumentActionTaskPane = true;
    }
}

Posted on:
Posted in Office, VSTO | Comments Off on VSTO Action Pane Closing

Another VSTO ListObject Bug

With extensive use of the ListObject in an Excel VSTO project, I have identified a second actual bug in the ListObject. This one also has to do with pasting data like the previous bug I posted about, but this time data is being lost instead of created erroneously.

Posted on:
Posted in Office, VSTO | Comments Off on Another VSTO ListObject Bug

Adding Images to CommandBarButtons in VSTO

An old VSTO 2003 post by Kathleen McGrath about how to add images to a CommandBarButton. It still works in VSTO 2005. The example uses the AxHost object to convert bitmaps to stdole.IPictureDisp types for Office toolbars.

Posted on:
Posted in Office, VSTO | Comments Off on Adding Images to CommandBarButtons in VSTO

VSTO Excel ListObject Bug

I found an actual bug with the VSTO ListObject in Excel and insertions of data. See this post on the MSDN forums for details.

Posted on:
Posted in Office, VSTO | Comments Off on VSTO Excel ListObject Bug

C#, VSTO 2005 and ActiveCell.Offset

Just a quick tidbit about using the Excel object model and C# in VSTO 2005. ActiveCell.Offset (as we know it in VBA, and even VB.Net) is not there in exactly the same way with C#. The syntax for C# is:

ActiveCell.get_Offset(1,1).Value2 = 22

And of course you need to use Value2 instead of Value, it’s not like there is any choice there anyway.

Posted on:
Posted in Office, VSTO | Comments Off on C#, VSTO 2005 and ActiveCell.Offset