none
Error 0x800A01A8 thrown after Undo in PowerPoint RRS feed

  • Question

  • My code has to merge selected shapes into one by 1. finding the topmost shape 2. making combined string 3. putting string to the topmost shape 4. deleting other shapes. It works fine, but if user does UNDO (Ctrl+Z), and error 0x800A01A8 is thrown. Any ideas?

     
    '_firstCoordinate stores .Top coordinates, _allCoordinates finds shapes through these coordinates
            Dim _firstCoordinate As New List(Of Single)
            Dim _allCoordinates As New Dictionary(Of Single, PPT.Shape)
    
    'Omitted code for initiatization, sorting, etc
    '====
    '====
    
      'This works fine
            If _allCoordinates(_firstCoordinate(0)).HasTextFrame Then
                If _allCoordinates(_firstCoordinate(0)).TextFrame.HasText Then
                    _combinedString = _allCoordinates(_firstCoordinate(0)).TextFrame.TextRange.Text + Environment.NewLine
                Else
                    _combinedString = ""
                End If
            Else
                _exitMarker = True
            End If
    
    'Make combined text string and delete shapes
            For i = 1 To _firstCoordinate.Count - 1 Step 1
                If _allCoordinates(_firstCoordinate(i)).HasTextFrame Then
                    'This line throws error (.TextFrame.HasText)
                    If _allCoordinates(_firstCoordinate(i)).TextFrame.HasText Then
                        _combinedString = _combinedString + _allCoordinates(_firstCoordinate(i)).TextFrame.TextRange.Text + Environment.NewLine
    
                        _allCoordinates(_firstCoordinate(i)).Delete()
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(_allCoordinates(_firstCoordinate(i))) : _allCoordinates(_firstCoordinate(i)) = Nothing
    
                    End If
                End If
            Next


    • Edited by herrpuqq Wednesday, January 14, 2015 10:59 AM
    Wednesday, January 14, 2015 10:35 AM

All replies

  • Hi Herrpuqq,

    Thanks for posting in MSDN forum.

    According to the description, you got the error when you does UNDO action after you combine the string into anther shape.

    However, based on the code, it got error when the code is running? Did I misunderstood? Would you mind sharing more detail about the issue?

    Since it seems the issue relative to the code, would you mind sharing a workable demo to help us reproduce this issue?

    You can upload it via OneDrive and please remove the sensitive information before you uploading.

    Regards & Fei


    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.

    Friday, January 16, 2015 2:40 AM
    Moderator
  • Hi Herrpuqq,

    Thanks for posting in MSDN forum.

    According to the description, you got the error when you does UNDO action after you combine the string into anther shape.

    However, based on the code, it got error when the code is running? Did I misunderstood? Would you mind sharing more detail about the issue?

    Since it seems the issue relative to the code, would you mind sharing a workable demo to help us reproduce this issue?

    You can upload it via OneDrive and please remove the sensitive information before you uploading.

    Regards & Fei


    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.

    The code merges strings and then deletes empty shapes (keeps the upmost only). I get error when I try to access TextFrame.HasText for the shape that were previously deleted. .HasTextFrame and .Top works fine. 

    This is the entire sub

    Dim _firstCoordinate As New List(Of Single)
            Dim _allCoordinates As New Dictionary(Of Single, PPT.Shape)
            _allCoordinates.Clear()
            Dim i As Integer
            Dim _combinedString As String
            Dim _exitMarker As Boolean = False
    
            'Make list
            Dim shp As PPT.Shape
    
    
            For Each shp In Globals.ThisAddIn.Application.ActiveWindow.Selection.ShapeRange
                If _allCoordinates.ContainsKey(shp.Top) Then
                    shp.Top = shp.Top - 1
                End If
                _firstCoordinate.Add(shp.Top)
                _allCoordinates.Add(shp.Top, shp)
            Next
    
    
            'Sort list
            _firstCoordinate.Sort()
    
            'This works fine
            If _allCoordinates(_firstCoordinate(0)).HasTextFrame Then
                If _allCoordinates(_firstCoordinate(0)).TextFrame.HasText Then
                    _combinedString = _allCoordinates(_firstCoordinate(0)).TextFrame.TextRange.Text + Environment.NewLine
                Else
                    _combinedString = ""
                End If
            Else
                _exitMarker = True
            End If
    
            If _exitMarker Then
                MsgBox("Unsuitable topmost shape")
                Exit Sub
            End If
    
            'Make combined text string and delete shapes
            For i = 1 To _firstCoordinate.Count - 1 Step 1
                If _allCoordinates(_firstCoordinate(i)).HasTextFrame Then
                    'This line throws error (.TextFrame.HasText)
                    If _allCoordinates(_firstCoordinate(i)).TextFrame.HasText Then
                        _combinedString = _combinedString + _allCoordinates(_firstCoordinate(i)).TextFrame.TextRange.Text + Environment.NewLine
                        _allCoordinates(_firstCoordinate(i)).Delete()
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(_allCoordinates(_firstCoordinate(i))) : _allCoordinates(_firstCoordinate(i)) = Nothing
    
                    End If
                End If
            Next
    
            'Put to first shape
            _allCoordinates(_firstCoordinate(0)).TextFrame.TextRange.Text = _combinedString
    
            

    Friday, January 16, 2015 10:12 AM
  • Hi Herrpuqq,

    Thanks for the detail expliantation. I could reproduce this issue too.

    Since the issue is complex and need to further investigation, I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!

    Regards & Fei


    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, January 19, 2015 3:00 AM
    Moderator
  • Hi,

    I tried to reproduce the issue. It seems the issue needs in depth troubleshooting.

    Because of its complexity your question falls into the paid support category which requires a more in-depth level of
    support.  If the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged. Please visit the below link to see the various paid support options that are
    available to better meet your needs.
    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone


    Sangeeth,MSFT

    Wednesday, February 4, 2015 11:36 PM
  • Hi,

    I tried to reproduce the issue. It seems the issue needs in depth troubleshooting.

    Because of its complexity your question falls into the paid support category which requires a more in-depth level of
    support.  If the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged. Please visit the below link to see the various paid support options that are
    available to better meet your needs.
    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone


    Sangeeth,MSFT

    Some other time maybe. This is not the first serious bug we encounter with VSTO tools and really question our platform of choice.
    Wednesday, February 11, 2015 9:47 AM
  • Any news on this one?  Been dealing with the same exact issue.  Is this considered the best answer? Buy support? C'mon....
    Thursday, July 16, 2015 3:30 PM