Hallo Leute,
ich komme nicht weiter und ich hoffe, dass mir hier weitergeholfen werden kann.
Ich habe einen VBA-Code erstellt, der die Excel-Datei als XML "umschreibt", hier der Code:
Spoiler anzeigen
Das Problem ist, dass ich bei FName manchmal das "&" benutze, was meine XML Datei zerschießt. Meine Frage, wie kriege ich es hin, dass das "&" zu "&" wird?
Habe es mit
probiert, leider ohne Erfolg.
Ich bedanke mich schon einmal im Voraus!
Gruß
ich komme nicht weiter und ich hoffe, dass mir hier weitergeholfen werden kann.
Ich habe einen VBA-Code erstellt, der die Excel-Datei als XML "umschreibt", hier der Code:
Visual Basic-Quellcode
- Sub XML_Export()
- Dim Datei As String, Text As String
- Dim Zeile As Long
- Dim alt As String
- Dim neu As String
- On Error GoTo Hell
- 'Speichern
- Datei = ThisWorkbook.Path & "\KPI.xml"
- Open Datei For Output As #1
- 'reinschreiben
- Print #1, "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?> "
- Print #1, "<dataroot>"
- 'Schleife
- For Zeile = 2 To 23
- Print #1, "<tblFirma>"
- Print #1, "" & vbTab & "<FName>" & Cells(Zeile, 1) & "</FName>"
- Print #1, "" & vbTab & "<Headquater>" & Cells(Zeile, 2) & "</Headquater>"
- Print #1, "" & vbTab & "<Turnover>" & Cells(Zeile, 3) & "</Turnover>"
- Print #1, "" & vbTab & "<Markets>" & Cells(Zeile, 4) & "</Markets>"
- Print #1, "" & vbTab & "<Locations>" & Cells(Zeile, 5) & "</Locations>"
- Print #1, "" & vbTab & "<FShare>" & Cells(Zeile, 6) & "</FShare>"
- Print #1, "" & vbTab & "<qmtotal>" & Cells(Zeile, 7) & "</qmtotal>"
- Print #1, "" & vbTab & "<qmpOutlet>" & Cells(Zeile, 8) & "</qmpOutlet>"
- Print #1, "" & vbTab & "<Employees>" & Cells(Zeile, 9) & "</Employees>"
- Print #1, "" & vbTab & "<Formats>" & Cells(Zeile, 10) & "</Formats>"
- Print #1, "" & vbTab & "<DC>" & Cells(Zeile, 11) & "</DC>"
- Print #1, "" & vbTab & "<SKU>" & Cells(Zeile, 12) & "</SKU>"
- Print #1, "" & vbTab & "<ERP>" & Cells(Zeile, 13) & "</ERP>"
- Print #1, "" & vbTab & "<Logistic>" & Cells(Zeile, 14) & "</Logistic>"
- Print #1, "" & vbTab & "<CRM>" & Cells(Zeile, 15) & "</CRM>"
- Print #1, "" & vbTab & "<Merch>" & Cells(Zeile, 16) & "</Merch>"
- Print #1, "" & vbTab & "<POS>" & Cells(Zeile, 17) & "</POS>"
- Print #1, "" & vbTab & "<Webshop>" & Cells(Zeile, 18) & "</Webshop>"
- Print #1, "" & vbTab & "<PIM>" & Cells(Zeile, 19) & "</PIM>"
- Print #1, "" & vbTab & "<MDM>" & Cells(Zeile, 20) & "</MDM>"
- Print #1, "" & vbTab & "<EBIT>" & Cells(Zeile, 21) & "</EBIT>"
- Print #1, "" & vbTab & "<Profit>" & Cells(Zeile, 22) & "</Profit>"
- Print #1, "" & vbTab & "<Revenue>" & Cells(Zeile, 23) & "</Revenue>"
- Print #1, "" & vbTab & "<CEO>" & Cells(Zeile, 24) & "</CEO>"
- Print #1, "" & vbTab & "<CFO>" & Cells(Zeile, 25) & "</CFO>"
- Print #1, "" & vbTab & "<CIO>" & Cells(Zeile, 26) & "</CIO>"
- Print #1, "</tblFirma>"
- Next Zeile
- Print #1, "</dataroot>"
- Close #1
- Exit Sub
- Hell:
- Close #1
- MsgBox "FehlerNr.: " & Err.Number & vbNewLine & vbNewLine _
- & "Beschreibung: " & Err.Description _
- , vbCritical, "Fehler"
- End Sub
Das Problem ist, dass ich bei FName manchmal das "&" benutze, was meine XML Datei zerschießt. Meine Frage, wie kriege ich es hin, dass das "&" zu "&" wird?
Habe es mit
probiert, leider ohne Erfolg.
Ich bedanke mich schon einmal im Voraus!
Gruß