none
Lack of Office 365 (local instal) COM Automation support - need a definitive list of the versions and their support for automation. RRS feed

  • Question

  • I develop an application that does some PowerPoint automation using embedded interop types (C# App - with VB assembly that does the office automation part)

    I've started to get reports that the PowerPoint automation is failing on Office 365.

    Here is a sample of a typical customer complaint:

    ----------------------------------------

    not exporting to powerpoint...

    We recently migrated from Office2007 to O365. That would be definitely the reason.

    But how can we solve this?

    -----------------------------------------

    I found the following reply to a forum question:

    https://social.msdn.microsoft.com/Forums/office/en-US/3c95eea4-641f-4bf0-a166-ecf33177854b/does-desktop-versions-of-applications-in-office-365-packages-support-comautomation?forum=exceldev

    But it only states that one version doesn't - and then one version does - doesn't reference a list of all support versions.

    Also - later - in that thread - it is shown that the accepted answer is actually incorrect.

    A sample of the type of code used to interact is shown here....

        Public Function PositionSlideTitle(ByVal slide As PowerPoint.Slide, ByVal height As Single, ByVal marginX As Single, ByVal marginY As Single) As PowerPoint.Shape
            Dim shapes As PowerPoint.Shapes
            Dim shape As PowerPoint.Shape

            ' get the shapes on the slide
            shapes = slide.Shapes
            ' get the shape that holds the title
            ' if the shapes collection has a title, then this title shape is always in index 1
            If shapes.HasTitle = Office.MsoTriState.msoTrue Then
                ' the title shape can also be accessed by the special property Title
                shape = shapes.Title
            Else
                ' If there was no title - then add one
                shape = shapes.AddTitle()
            End If

            ' position the shape at 0,0 (seems not to want to go there)
            shape.Left = marginX
            shape.Top = marginY
            ' stretch image to fit slide
            shape.Width = slide.Master.Width - (marginX * 2)
            shape.Height = height

            Return shape
        End Function

    The project references Microsoft.Office.Interop.PowerPoint, version 11.0.0.0 with it's "Embed Interop Types" set to true.

    This has worked for 10+ years, with all versions of office from Office 2003.  We still need the application to support Office 2003 - and it still does perfectly, so referencing newer PIA's isn't an option.

    Please help.

    • Moved by Youjun Tang Monday, April 27, 2015 1:59 AM more related to the suggested forum
    Friday, April 24, 2015 1:11 AM

Answers

  • yes - that's the thread.

    Using that I've actually fixed the issue and sent out a hotfix - that's exactly what it was.

    Here is a simplified version of what I ended up doing - perhaps it can help someone else.

            
        Imports PowerPoint = Microsoft.Office.Interop.PowerPoint
    
            Public Sub PasteSpecialAndSendToBack(ByVal slide As PowerPoint.Slide, ByVal dataType As PowerPoint.PpPasteDataType)
                
                Dim shapeRange As PowerPoint.ShapeRange
                shapeRange = slide.Shapes.PasteSpecial(dataType)
                
                Dim shape2013 As PowerPoint.Shape = Nothing
                If shapeRange.Count > 1 Then
                    shape2013 = shapeRange.Item(1)
                End If
                
                If (shape2013 Is Nothing) Then
                    shapeRange.ZOrder(MsoZOrderCmd.msoSendToBack)
                Else
                    shape2013.ZOrder(MsoZOrderCmd.msoSendToBack)
                End If
                
            End Function

    • Marked as answer by Muffin Chops Wednesday, April 29, 2015 12:46 PM
    Wednesday, April 29, 2015 10:12 AM

All replies

  • Hi Muffin Chops,

    As your issue is related to Office, I'm moving your post to Office forum for help, thanks for your understanding.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=officegeneral

    Regards,
    Youjun Tang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, April 27, 2015 1:57 AM
  • ok - well - maybe I get a response on this forum then.. thanks

    You'd think that MS would actually have a definitive list somewhere without people having to resort to conjecture and querying forums though.....

    Monday, April 27, 2015 5:08 AM
  • Hello Muffin,

    All Office versions support COM Automation.

    You look for the most appropriate forum and post questions. If you used a wrong forum, a moderator can move the question to the "right" forum.

    Well, it can be various reasons why your code fails. It would be better to the see the error description first. Do you get exceptions in the code? If so, what line of code fires the exception?

    At the moment I see the following possible issues:

    1. Your end users use the Click2Run edition of MS Office 2010. The Office 2010 Click-to-Run compatibility with add-ins page states the following:

    Out-of-process add-ins/applications are stand-alone programs, scripts, or applications that use Office object model APIs to start functionality in the application and integrate with Office. In this case, the out-of-process application drives Office. Out-of-process applications are not supported in Click-to-Run.

    If that is the case you need to re-install Office using the .msi installer.

    2. Errors may come if you run an Office application and your own app with different permission level.

    Monday, April 27, 2015 5:53 PM
  • Great to know that all versions of Office Support Com Automation.

    Because the end-users that have made the complaint - are using Office 365 - it wouldn't be the Click2Run edition as you've mentioned - but it's good to know that information, as I wasn't aware there was a possible issue with that - thanks.

    I'll just assume then that the end user that sent the following issue is running them with different permission level:

    ----------------------------------------

    not exporting to powerpoint...

    We recently migrated from Office2007 to O365. That would be definitely the reason.

    But how can we solve this?

    -----------------------------------------

    Although - one more thought - I read somewhere that O365 users can install office via the O365 portal - I wonder whether this is the same as Click2Run install - and hence causing the same out-of-process application error you have referred to?

    Kind Regards

    UPDATE:

    Further reading/searching on click-to-run and O365 found the following:


    I can't paste links in this forum, but:

    technet microsoft com "en-us/library/jj219427.aspx"

    Eugene - you may be onto something with the click-to-run issue - that may be the cause of the error in O365 installations - At least now I have a scenario to test against (user info is always difficult to determine exactly how to replicate issues) - Cheers.

    Monday, April 27, 2015 11:31 PM
  • It seems you missed my questions...

    Would be great to the see the error description first. Do you get exceptions in the code? If so, what line of code fires the exception?


    Tuesday, April 28, 2015 7:20 AM
  • Hi,

    Sorry - I didn't have that information. I do now - after I setup an environment to test.

    I get the following exception:

    System.Runtime.InteropServices.COMException (0x800A01A8): Exception from HRESULT: 0x800A01A8
       at Microsoft.Office.Interop.PowerPoint.ShapeRange.ZOrder(MsoZOrderCmd ZOrderCmd)

    when running the code

    shapeRange.ZOrder(Microsoft.Office.Core.MsoZOrderCmd.msoSendToBack)

    I've checked shapeRange - it is a PowerPoint.ShapeRange, and is not Nothing.

    Tuesday, April 28, 2015 2:50 PM
  • Ok - this looks as if it may actually be a known bug in PowerPoint 2013

    "Setting ShapeRange Property After PasteSpecial Thows HRESULT 0x800A01A8 in PowerPoint 2013"

    (from social Microsoft forums)


    Unfortunately - the links from this forum thread are now dead - and I can't paste links into this forum....

    Tuesday, April 28, 2015 11:56 PM
  • Hi Muffin,

    I suppose you are talking about the Setting ShapeRange Property After PasteSpecial Thows HRESULT 0x800A01A8 in PowerPoint 2013 forum thread.

    Wednesday, April 29, 2015 6:44 AM
  • yes - that's the thread.

    Using that I've actually fixed the issue and sent out a hotfix - that's exactly what it was.

    Here is a simplified version of what I ended up doing - perhaps it can help someone else.

            
        Imports PowerPoint = Microsoft.Office.Interop.PowerPoint
    
            Public Sub PasteSpecialAndSendToBack(ByVal slide As PowerPoint.Slide, ByVal dataType As PowerPoint.PpPasteDataType)
                
                Dim shapeRange As PowerPoint.ShapeRange
                shapeRange = slide.Shapes.PasteSpecial(dataType)
                
                Dim shape2013 As PowerPoint.Shape = Nothing
                If shapeRange.Count > 1 Then
                    shape2013 = shapeRange.Item(1)
                End If
                
                If (shape2013 Is Nothing) Then
                    shapeRange.ZOrder(MsoZOrderCmd.msoSendToBack)
                Else
                    shape2013.ZOrder(MsoZOrderCmd.msoSendToBack)
                End If
                
            End Function

    • Marked as answer by Muffin Chops Wednesday, April 29, 2015 12:46 PM
    Wednesday, April 29, 2015 10:12 AM
  • Great news! Thank you for letting us know.
    Wednesday, April 29, 2015 12:19 PM