einer Excel Datei auslesen kann und diese dann
in ein xml Dokument schreiben kann?
Danke schon mal im voraus :-)
Gruß Fisi
Sub xx()
' File System Object for accessing the filesystem
Dim fso, fileWrite
Const ForWriting = 2
Set fso = CreateObject("Scripting.FileSystemObject")
Dim Outputfile As String
' set outputfile(xml)
Outputfile = "\\kschneid01\ups\XML\Grisebach4.xml"
Set fileWrite = fso.createTextFile(Outputfile, ForWriting, True) ' create TextFile(the XML File)
' Write the xml file / first part
fileWrite.WriteLine "<?xml version=" & Chr(34) & "1.0" & Chr(34) & "?>"
fileWrite.WriteLine "<OpenShipments xmlns=" & Chr(34) & "x-schema:OpenShipments.xdr" & Chr(34) & ">"
Dim A1, A2, A3, A4, A5
A1 = Worksheets("Tabelle1").Cells(1, 1) Gib A1 den Wert, der in Spalte Nr. 1 und Zeile Nr. 1 des Excel-Sheets steht
A2 = Worksheets("Tabelle1").Cells(2, 1)
A3 = Worksheets("Tabelle1").Cells(3, 1)
A4 = Worksheets("Tabelle1").Cells(4, 1)
A5 = Worksheets("Tabelle1").Cells(5, 1)
' write OpenShipment-Tag
fileWrite.WriteLine " <OpenShipment ProcessStatus=" & Chr(34) & Chr(34) & ">"
' write OpenShipment/Reciver
fileWrite.WriteLine "<Receiver>"
fileWrite.WriteLine "<CompanyName> <![CDATA[" & A1 & "]]></CompanyName>"
fileWrite.WriteLine "<ContactPerson><![CDATA[" & A2 & "]]></ContactPerson>"
fileWrite.WriteLine "<AddressLine1> <![CDATA[" & A3 & "]]></AddressLine1>"
fileWrite.WriteLine "<AddressLine2> <![CDATA[" & A4 & "]]></AddressLine2>"
fileWrite.WriteLine "<AddressLine3> <![CDATA[" & A5 & "]]></AddressLine3>"
fileWrite.WriteLine "</Receiver>"
' close the OpenShipments-Tag at end of file
fileWrite.WriteLine "</OpenShipments>"
'close files
fileWrite.Close
MsgBox "Fertig!", vbOKOnly
End Sub