none
Excel add-in won't load when opening Outlook attachment RRS feed

  • Question

  • Hey everyone. I've run into a situation where my Excel 2010 automation add-in won't load when opening an Excel file as an attachment. More specifically, only in the situation where I have Excel already opened (and the add-in running fine) and then try to open the Excel attachment. 

    My LoadBehavior is set to 3 and the add-in runs fine in all other situations. I should note that this isn't on my development machine, but a user's computer running Excel 2010 and Windows 7. Could this be as simple as telling Windows to open Excel files in the same instance? 

    thanks!

    Monday, March 5, 2012 10:25 PM

Answers

  • Hi hesuaro,

    Thanks for posting in the MSDN Forum.

    It's based on my experience taht add-in will not work due to security conside. There have a lot of limitation to run script when Outlook is the host. I don't think it has any problem. You can run your add-in if you save your attachment to your hard disk.

    If I have misunderstood anything, please feel free to let me know.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us


    Monday, March 12, 2012 4:45 AM
    Moderator

All replies

  • You might need something like this to first detect if an instance of Excel is already open and if not start one.

    Imports Process = System.Diagnostics.Process
                If Process.GetProcessesByName("EXCEL").Count > 0 Then
                    xApp = Marshal.GetActiveObject("Excel.Application")
                    xApp.Visible = True
                    newXL = False
                Else
                    xApp = New Excel.Application
                    xApp.Visible = True
                    newXL = True
                End If


    Kind Regards, Rich ... http://greatcirclelearning.com

    Monday, March 5, 2012 11:42 PM
  • Hey thanks Rich. I was kind of hoping for something I could put within the code of my managed Excel add-in, or even just find a general windows/Excel setting. I'm assuming your code would run either in Outlook and check every attachment, or as a stand alone process. 

    Anybody have any ideas? 

    Tuesday, March 6, 2012 3:31 PM
  • Maybe I misunderstood.

    Are you saying that if a user opens Outlook and there's an email with an attached Excel workbook, if they open the workbook and Excel was not running, that your add-in does not load with Excel? 

    However, if they already have Excel running ... what happens?


    Kind Regards, Rich ... http://greatcirclelearning.com

    Tuesday, March 6, 2012 10:34 PM
  • If a user opens an Excel workbook as an attachment...

    with Excel already opened: Excel add-in does not load in the attachment workbook

    without Excel opened: Excel starts and the add-in loads

    Sorry for being unclear -- it's a pretty specific case in which the add-in doesn't load. Thanks again for your help. 

    Wednesday, March 7, 2012 3:00 PM
  • How do you determine if your add-in does not load into workbook from attachment? Your ribbon buttons do not show up?
    Wednesday, March 7, 2012 3:23 PM
  • you got it
    Wednesday, March 7, 2012 9:10 PM
  • if you save that specific attachment to disk and double click it to open (with excel running) - do you also experience that behaviour?
    Thursday, March 8, 2012 9:16 AM
  • Hi hesuaro,

    Thanks for posting in the MSDN Forum.

    It's based on my experience taht add-in will not work due to security conside. There have a lot of limitation to run script when Outlook is the host. I don't think it has any problem. You can run your add-in if you save your attachment to your hard disk.

    If I have misunderstood anything, please feel free to let me know.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us


    Monday, March 12, 2012 4:45 AM
    Moderator
  • Hi Tom,

    For me it works fine with Office 2010. But I am facing this issue with Office 2013 may be because of SDI architecture in Excel 2013.

    Praveen

    Monday, April 28, 2014 11:55 AM