Excel COM Add-in with user defined function RRS feed

  • General discussion

  • We use the VSTO classes to create an Excel COM add-in with a user defined function, both in C#.  In the user defined function, we access properties in the add-in using the Globals.ThisAddIn class.  When opening an .xls formatted spreadsheet in Excel we have no problem accessing these properties, however when opening an .xlsx formatted spreadsheet, the Globals.ThisAddIn class is null.   Any thoughts on why Globals.ThisAddIn is null in this situation?

    Another pattern that I noticed is that if I open an .xls spreadsheet first, then an .xlsx (or .xlsm), Globals.ThisAddIn is filled out fine (not null), for all formats.  However, if I open an .xlsx first, then Globals.ThisAddIn is null for all formats.  I would also point out that I do not execute any of my code based on the format of the spreadsheet that is being opened.  All formats go through the same code, in both the ThisAddIn.cs and the user defined function.

    Thank you,

    Michael Ahrendsen

    • Changed type Quist Zhang Thursday, August 1, 2013 5:59 AM
    Monday, July 1, 2013 1:13 PM

All replies

  • Hi Mike,

    Thank you for posting in the MSDN Forum.

    Could you please provide more information on your project?

    It will be nice if you could create a sample add-in project which reproduces your scenario and upload it to SkyDrive. You can then make it accessible and share the link with us.

    I look forward to your reply.

    Best regards,

    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 2, 2013 7:58 AM