none
Excel 2007 Add-in and Internet Explorer RRS feed

  • Question

  • Hi all,

    We've developed an Excel 2007 Add-in for use with our main product (which delivers documents stored in a database via both a Windows application and a web application).

    Also stored in the database are a load of security details which instruct our Add-in on whether to enable/disable Save, Save As, Print, Cut, Copy, Paste, etc and when viewing the document through our Windows application all works well. However, viewing the document through IE does not seem to allow the Add-in to disable these commands. The document is extracted out of the database in Java and a hyperlink is created to simply redirect the browser to a temporary copy of the document. The user gets the Open/Save/Cancel dialog and if they open the document directly, the Add-in fails to do the necessary work (even though the Add-in is available in Excel) HOWEVER saving the document to my desktop then opening it DOES work.

    By the way, the security details on whether to disable certain command/options is passed to the Excel Add-in via a web service. This all works fine in our Word 2007 Add-in and PowerPoint 2007 Add-in.

    What is different in viewing Excel documents in Internet Explorer to stop this working???

    Many thanks,

    Paul.

    Wednesday, May 11, 2011 9:43 AM

Answers

  • Problem solved.

    We use all the IDTExtensibility2 stuff and use the OnConnection and Workbook_Open events to load the security details into the Add-in and set the necessary controls to disabled. When opening Excel through Internet Explorer the Workbook_Open event does not get fired (even though it does through our Windows application and if you write a macro that uses the Workbook_Open event).

    We've changed our Add-in so that if it doesn't execute our code first time round (through the Workbook_Open event) then it runs it in the Workbook_Activate event, using flags where necessary to make sure it is only fired once. It works perfectly.

    Thanks Andrei, for all your help.

    Paul.

    • Marked as answer by devman77 Wednesday, May 11, 2011 3:39 PM
    Wednesday, May 11, 2011 3:38 PM

All replies

  • Hello Paul,

    Pay attention that when using IE7-9 on a system supplied with UAC, IE can be run in Protected Mode (default) and this can make doing some things [almost] impossible. Say, when in Protected Mode, you cannot save a file to an arbitrary location. Not sure if all the Protected Mode stuff applies to your case, though.

    Do you disable the corresponding Ribbon commands? Are there any errors in this particular case? Do you tick the "Show add-in user interface errors" checkbox? Can you add a Ribbon button and test if you can disable the commands in the Click event of that button? And, does your add-in get all required events when Excel is started in that way?


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    Wednesday, May 11, 2011 11:39 AM
  • Hi Andrei,

    I think I'm getting a little closer to the problem but not necessarily any closer to the solution.

    We don't get any errors the the "Show add-in user interface errors" option. However I've ran some tests and put a MsgBox in a macro in both a Word 2007 document and Excel 2007 workbook, Document_Open and Workbook_Open events respectively. When viewing the files via our Windows application Word and Excel both appear first, loading the respective files, and then the test message appears. Doing the same through Internet Explorer I get the test message first before either Word or Excel is visible. It seems that even though Word isn't visible all the events can fire and the necessary controls are disabled. Excel behaves differently in that although the test message appears it's almost as if all the handles for Excel's controls have yet to be created and therefore nothing is disabled.

    We've just added some debug messages to out Excel Add-in. When called through our Windows application the Application_WorkbookOpen event is fired. When called from Internet Explorer it's not. All our code executes within this event.

    Is this a bug in Excel???

    Paul.

    Wednesday, May 11, 2011 2:03 PM
  • > Is this a bug in Excel???

    It's known for a long time that all(?) Office application produce a different order of events in different situations. For instance, opening a document from the Start menu produces a different order of events when compared with opening a document from Excel/Word itself.


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    Wednesday, May 11, 2011 2:29 PM
  • Problem solved.

    We use all the IDTExtensibility2 stuff and use the OnConnection and Workbook_Open events to load the security details into the Add-in and set the necessary controls to disabled. When opening Excel through Internet Explorer the Workbook_Open event does not get fired (even though it does through our Windows application and if you write a macro that uses the Workbook_Open event).

    We've changed our Add-in so that if it doesn't execute our code first time round (through the Workbook_Open event) then it runs it in the Workbook_Activate event, using flags where necessary to make sure it is only fired once. It works perfectly.

    Thanks Andrei, for all your help.

    Paul.

    • Marked as answer by devman77 Wednesday, May 11, 2011 3:39 PM
    Wednesday, May 11, 2011 3:38 PM