'Getting error "user-defined type not defined"

I am using one existing VBA macro code to convert the xml data into table format and Vise versa from the excel sheet. It was working fine on windows 7. But in windows 10 I am getting the error saying that ""user-defined type not defined" on the line of code "Dim XmlDoc As MSXML2.DOMDocument"

Please help me How I can resolve this error ?

Private Function ParseRateClob(ByRef ClobRange As Range, ByRef StartRow As Long, ByRef ColumnMap As Object, ByVal ColumnLimit As Integer, ByRef Pk() As String) As Integer
    Dim XmlDoc As MSXML2.DOMDocument
    Dim ComplexList As MSXML2.IXMLDOMSelection
    Dim ComplexNode As MSXML2.IXMLDOMNode
    Dim DimensionsNode As MSXML2.IXMLDOMNode
    Dim DimensionNode As MSXML2.IXMLDOMNode
    Dim ComplexXPath As String
    Dim ClobStr As String: ClobStr = ""
    Dim Name As String
    Dim Value As String
    Dim Column As Integer
    Dim MaxColumn As Integer
    Dim i As Long
    Dim j As Long
    Dim c As Range
    Dim Data() As Variant
    MaxColumn = 1
    For Each c In ClobRange
        Value = c.Value
        If InStr(Value, "'=") = 1 Then
            Value = Mid(Value, 2, Len(Value) - 1)
        End If
        ClobStr = ClobStr & Value
    Next
    Set XmlDoc = New MSXML2.DOMDocument
    If XmlDoc.LoadXML(ClobStr) Then
        Set ComplexList = XmlDoc.SelectNodes(COMPLEX_XPATH)
        'note that lists are zero based
        For i = 0 To (ComplexList.Length - 1)
            If i = 0 Then
                ReDim Data(1, ColumnLimit)
                Data(1, 1) = Pk(1)
            Else
                Call AddRow(Data)
            End If
            For j = 2 To 5
                Data(i + 1, j) = Pk(j)
            Next j
            Set ComplexNode = ComplexList.Item(i)
            For j = 0 To (ComplexNode.ChildNodes.Length - 2)
                Name = ComplexNode.ChildNodes.Item(j).Attributes.Item(0).Text
                Value = ComplexNode.ChildNodes.Item(j).Attributes.Item(1).Text
                Column = GetColumn(Name, MaxColumn, ColumnMap, ColumnLimit)
                Data(i + 1, Column) = Value
            Next
            Set DimensionsNode = ComplexNode.ChildNodes.Item(ComplexNode.ChildNodes.Length - 1)
            For j = 0 To (DimensionsNode.ChildNodes.Length - 1)
                Set DimensionNode = DimensionsNode.ChildNodes.Item(j)
                Name = DimensionNode.ChildNodes.Item(0).Attributes.Item(1).Text
                Value = DimensionNode.ChildNodes.Item(2).Attributes.Item(1).Text
                Column = GetColumn(Name, MaxColumn, ColumnMap, ColumnLimit)
                Data(i + 1, Column) = EscapeXL(Value)
            Next
        Next
    Else
        Err.Raise XmlDoc.parseError.ErrorCode, "", XmlDoc.parseError.reason
    End If
    Range(Cells(StartRow, 1), Cells(StartRow + i - 1, MaxColumn)) = Data
    ActiveSheet.Hyperlinks.Add Anchor:=Cells(StartRow, 1), Address:="", SubAddress:=Replace(Data(1, 1), "$", "")
    StartRow = StartRow + i
    ParseRateClob = MaxColumn
End Function


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source