Hallo,
Ich habe eine Excel Datei aus welcher ich mittels VBA Dateien auslese und in eine Datei speichern möchte.
Klappt soweit auch wunderbar, nur leider liefert mir die Zeile "ActiveDocument.Path" den Fehler "Object Required" - woran könnte das liegen?
Hier mein Code:
Danke im Vorraus,
mfg
Ich habe eine Excel Datei aus welcher ich mittels VBA Dateien auslese und in eine Datei speichern möchte.
Klappt soweit auch wunderbar, nur leider liefert mir die Zeile "ActiveDocument.Path" den Fehler "Object Required" - woran könnte das liegen?
Hier mein Code:
Code:
Private Sub Schaltfläche1_BeiKlick()
myPath = ActiveDocument.Path
Open myPath & "\config.xml" For Output As #1
Print #1, "<?xml version=""1.0"" encoding=""ISO-8859-1"" ?>"
Print #1, "<config>"
Print #1, " <soldtoparty>"
Print #1, " <company>" & ThisWorkbook.Worksheets("Tabelle1").Cells(4, 2).Value & "</company>"
Print #1, " <department>" & ThisWorkbook.Worksheets("Tabelle1").Cells(5, 2).Value & "</department>"
Print #1, " <street>" & ThisWorkbook.Worksheets("Tabelle1").Cells(6, 2).Value & "</street>"
Print #1, " <city>" & ThisWorkbook.Worksheets("Tabelle1").Cells(7, 2).Value & "</city>"
Print #1, " <postcode>" & ThisWorkbook.Worksheets("Tabelle1").Cells(8, 2).Value & "</postcode>"
Print #1, " </soldtoparty>"
Print #1, " <material>"
Print #1, " <code>" & ThisWorkbook.Worksheets("Tabelle1").Cells(11, 2).Value & "</code>"
Print #1, " <description>" & ThisWorkbook.Worksheets("Tabelle1").Cells(12, 2).Value & "</description>"
Print #1, " <price>" & Replace(ThisWorkbook.Worksheets("Tabelle1").Cells(13, 2).Value, ",", ".") & "</price>"
Print #1, " </material>"
Print #1, "</config>"
Close #1
MsgBox "The config file has successfully been created"
End Sub
mfg