Range.InsertXML using Transform

强颜欢笑 提交于 2019-12-06 13:42:56

Working solution:

The original source for the xml appears to be from this docs.microsoft.com site. Incidentally, there are also some instructions on how to create an XSLT directly from a MS Word document (well, albeit manually).

At any rate, it's easiest to just to the transform and insert as two separate steps, like this:

Sub xmlTest()
    Dim xData As MSXML2.DOMDocument60
    Dim xTnsf As MSXML2.DOMDocument60
    Dim xOutp As MSXML2.DOMDocument60

    Set xData = New MSXML2.DOMDocument60
    Set xTnsf = New MSXML2.DOMDocument60
    Set xOutp = New MSXML2.DOMDocument60

    xData.Load "C:\Temp\MyMovies.xml"
    xTnsf.Load "C:\Temp\MyMovies.xslt"

    xData.transformNodeToObject xTnsf, xOutp

    ThisDocument.Range.InsertXML xOutp.XML

    Debug.Print xOutp.XML

End Sub
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!