Sub ApplyStyleSheetAndImport()
Dim myXMLDoc As New MSXML2.DOMDocument50
Dim myXSLDoc As New MSXML2.DOMDocument50
Dim newXMLDoc As New MSXML2.DOMDocument50
myXMLDoc.async = False
If myXMLDoc.Load("C:\data.xml") Then
myXSLDoc.Load "C:\trans.xsl"
If Not myXSLDoc Is Nothing Then
myXMLDoc.transformNodeToObject myXSLDoc, newXMLDoc
newXMLDoc.Save "C:\Converted.xml"
Application.ImportXML "C:\Converted.xml"
End If
End If
Set myXMLDoc = Nothing
Set myXSLDoc = Nothing
Set newXMLDoc = Nothing
End Sub
|