VBA/Excel/Access/Word/XML/XML Transformed

Материал из VB Эксперт
Перейти к: навигация, поиск

Applying a Stylesheet to an ADO XML Document and Importing It to Access

   <source lang="vb">

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

</source>