Xdata issues

I have some code written by someone else.

They apparently have been using Xdata to store information about certain cells.  They have routines to read the information back out of the cell (probably using the Xdata).  However, some of our cells have been corrupted and don't read back in correctly.  I've been looking at the code and running it on a corrupt cell to see if I can determine the problem.  When I run 'Debug.Print TempEle.HasAnyXData' it returns a 'True' which makes me believe there is Xdata associated with this cell.  However, I can't seem to determine the 'Application name' this information would be stored under?  Why does 'AppNames = TempEle.GetXDataApplicationNames' return an empty array?

Thanks in advance,

Christmas May

Parents
  • Unknown said:
    I can't seem to determine the 'Application name' this information would be stored under? Why does 'AppNames = TempEle.GetXDataApplicationNames' return an empty array?

    A code sample is worth 1,000 words. Please provide some context. Crucially, we need to see how you have declared variable AppNames.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Mr. Jon Summers,

    Thanks for the quick reply.  I've been able to correct the initial problem, although I'm not entirely sure how. (Changed several things.)  My question now is why the AppName is so weird?  It is producing '??? (ID &H9C4)' without the quotes.

    'My Added function.

    Public Function fBlnSearchCell(Cell As CellElement) As Boolean

       Dim TempEle As Element

       Dim appNames() As String

       Dim ElementNumber As Integer

       'Step through cell.

       Cell.ResetElementEnumeration

       ElementNumber = 0

       Do While Cell.MoveToNextElement

          ElementNumber = ElementNumber + 1

           Set TempEle = Cell.CopyCurrentElement

           If TempEle.IsTextElement Then

               'Debug.Print TempEle.HasAnyXData   'Prints "True" in the immediate window.

               appNames = TempEle.GetXDataApplicationNames

               For index = LBound(appNames) To UBound(appNames)

                  Debug.Print ElementNumber & ", " & TempEle.AsTextElement.Text

                  Debug.Print appNames(index)   'Prints "??? (ID &H9C4)"

               Next

           End If

       Loop

    End Function

    Sincerely,

    Christmas May

Reply
  • Mr. Jon Summers,

    Thanks for the quick reply.  I've been able to correct the initial problem, although I'm not entirely sure how. (Changed several things.)  My question now is why the AppName is so weird?  It is producing '??? (ID &H9C4)' without the quotes.

    'My Added function.

    Public Function fBlnSearchCell(Cell As CellElement) As Boolean

       Dim TempEle As Element

       Dim appNames() As String

       Dim ElementNumber As Integer

       'Step through cell.

       Cell.ResetElementEnumeration

       ElementNumber = 0

       Do While Cell.MoveToNextElement

          ElementNumber = ElementNumber + 1

           Set TempEle = Cell.CopyCurrentElement

           If TempEle.IsTextElement Then

               'Debug.Print TempEle.HasAnyXData   'Prints "True" in the immediate window.

               appNames = TempEle.GetXDataApplicationNames

               For index = LBound(appNames) To UBound(appNames)

                  Debug.Print ElementNumber & ", " & TempEle.AsTextElement.Text

                  Debug.Print appNames(index)   'Prints "??? (ID &H9C4)"

               Next

           End If

       Loop

    End Function

    Sincerely,

    Christmas May

Children