Hallo
ich hab folgendes Problem. Ich möchte ein XML String in VBA einlesen und die einzelnen Werte in eine Wordvorlage an die entsprechenden Textfelder ausgeben. Leider weiß ich nicht, wie ich die einzelnen Tags in einem XML Dokument anspreche.
With appWord
For Each p In parser.documentElement.childNodes
'.ActiveDocument.Bookmarks.Count
'Debug.Print p.getAttribute(„firmnr“),
.Application.Selection.Goto what:=wdGoToBookmark, Name:=(„faxnummer“)
If Not (p.childNodes(0) Is Nothing) Then
.Application.Selection.TypeText Text:=(p.childNodes(0).Text)
p.childNodes.nextNode
End If
.Application.Selection.Goto what:=wdGoToBookmark, Name:=(„an“)
If Not (p.childNodes(0) Is Nothing) Then
.Application.Selection.TypeText Text:=(p.childNodes(0).Text)
p.childNodes.nextNode
End If
.Application.Selection.Goto what:=wdGoToBookmark, Name:=(„an2“)
If Not (p.childNodes(0) Is Nothing) Then
.Application.Selection.TypeText Text:=(p.childNodes(0).Text)
p.childNodes.nextNode
End If
.Application.Selection.Goto what:=wdGoToBookmark, Name:=(„von“)
If Not (p.childNodes(0) Is Nothing) Then
.Application.Selection.TypeText Text:=(p.childNodes(0).Text)
p.childNodes.nextNode
End If
.Application.Selection.Goto what:=wdGoToBookmark, Name:=(„durchwahl“)
If Not (p.childNodes(0) Is Nothing) Then
.Application.Selection.TypeText Text:=(p.childNodes(0).Text)
p.childNodes.nextNode
End If
.Application.Selection.Goto what:=wdGoToBookmark, Name:=(„betreff“)
If Not (p.childNodes(0) Is Nothing) Then
.Application.Selection.TypeText Text:=(p.childNodes(0).Text)
p.childNodes.nextNode
End If
.Application.Selection.Goto what:=wdGoToBookmark, Name:=(„betreff“)
If Not (p.childNodes(0) Is Nothing) Then
.Application.Selection.TypeText Text:=(p.childNodes(0).Text)
p.childNodes.nextNode
End If
Next
end with
…leider werden so alle Werte in dem XML Doc pro Textmarke ausgelesen.
Schonmal Dank im Voraus
Chris