none
Problem running VBA macro with VSTO document level customisation when opened from IE using file://computer/share/doc.xlsm RRS feed

  • Question

  • We have an Excel 2010 Document level customisation that calls a VBA macro in its startup method like this:

          Me.Application.Run(MacroName)

    Now, if we open the document from a UNC file share it works: \\computer\share\Exceldoc.xlsm

    If we open it from IE using http://server/vdir/Exceldoc.xlsm - ok, fine, but we want to open it from IE

    So to workaround this, we've previously used this from our intranet application:

    file://computer/share/Exceldoc.xlsm

    Now this does run the vsto document level customisation but now when it calls the VBA macro we get an automation error and it blows up

    As you can imagine we have setup Trusted Locations and loosened VBA security to get this far. What else might we do? Or this now the intended behaviour?

    Thanks in advance,

    E

    Monday, August 8, 2016 5:20 PM

Answers

  • The answer to this issue was to remove and then reinstall Office.


    • Edited by ec__ Thursday, August 11, 2016 10:09 AM
    • Marked as answer by ec__ Thursday, August 11, 2016 10:09 AM
    Thursday, August 11, 2016 10:08 AM

All replies

  • >>>So to workaround this, we've previously used this from our intranet application:

    file://computer/share/Exceldoc.xlsm

    Now this does run the vsto document level customisation but now when it calls the VBA macro we get an automation error and it blows up<<<

    According to your description, I have tried to reproduce this issue, but when I enter "file://computer/shared/Customization.xlsm", this Excel file will be downloaded.

    So I suggest that you could provide more information about issue, for example steps, screenshot etc., that will help us reproduce and resolve it.

    In addition you could refer to How to: Publish a Document-Level Office Solution to a SharePoint Server

    Thanks for your understanding.

    Tuesday, August 9, 2016 4:28 AM
  • Hi David and thanks for your reply

    Yes, the Excel file starts to download, and we get asked to Open or Save.

    If we Save and then open the file from the local c drive then it works OK, the VSTO code runs and calls the VBA macro just fine

    If we launch Excel beforehand, and click Open then it also works just fine.

    But if Excel is not launched beforehand, then when we click to Open, then the VSTO bit works and code in the Startup event of the document levels customisation starts to run. But when it tries gets to the line that calls the VBA macro with 'Me.Application.Run(MacroName)' line we get an automation error:

    Click OK and then we see the VBA project on the first line of the macro - in this case it is Statuses:

    If we click Stop in the VBA IDE, control returns to our VSTO code and our exception handler shows us this:

    So that documents the error fairly well I hope. Note that whilst Excel appears in the Task Manager's Processes list when the error happens, it does not appear in the Programs list. I'll try to produce some detailed steps to reproduce it and post them below. E








    • Edited by ec__ Wednesday, August 10, 2016 2:06 PM
    Wednesday, August 10, 2016 10:58 AM
  • The answer to this issue was to remove and then reinstall Office.


    • Edited by ec__ Thursday, August 11, 2016 10:09 AM
    • Marked as answer by ec__ Thursday, August 11, 2016 10:09 AM
    Thursday, August 11, 2016 10:08 AM