Change vsto customization by an Add-In RRS feed

  • Question

  • When a vsto customized office excel file is opened if the code behind assembly is not found it gives an error. The assembly pointed by custom property "_AssemblyLocation" is wrong.

    I would like to create an AddIn which can check each documents being opened for a specific customization, and update customization when needed (with correct paths).

    I will be using Microsoft.VisualStudio.Tools.Applications.ServerDocument to handle this.

    But if i use Application_WorkbookOpen(Excel.Workbook Wb) to handle this, then it will be too late and the error comes.

    Is there any event which I could subscribe to, which is called when a workbook is attempted to be opened?

    Tuesday, November 8, 2011 8:32 AM

All replies

  • Is there a way to intercept or override Microsoft excel's File open command by an COM Addin? I want to process the file before Excel tries to open the workbook, so Application_WorkbookOpen is too late.

    Ideally it should be triggered when an excel file is double-clicked also.

    Tuesday, November 8, 2011 9:13 AM
  • Hi Gayan

    Workbook_Open is your only option. But you could get the name, close the file, process it, then open it again?

    Cindy Meister, VSTO/Word MVP
    Tuesday, November 8, 2011 9:45 AM
  • Hi Cindy,

    Thanks, the issue was actually I am trying to read the 'custom document properties' of an excel file and update its invalid assembly reference before the DeploymentDownloadException occurs. i.e. Update the "_AssemblyLocation" by ServerDocument or otherwise. But I cant beat the exception which gets fired *before* workbook_Open.


    Tuesday, November 8, 2011 9:51 AM