Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referencing XML Nodes in Word 2003 VBA

Status
Not open for further replies.

ppsza

Programmer
Joined
Apr 30, 2004
Messages
2
Location
US
I am trying to access xml elements in a word 2003 document (ActiveDocument) in VBA. I have discovered the XMLNodes collection of the ActiveDocument, but was disappointed to discover that elements of the collection can be referrenced by ordinal index number only! I am wondering if anyone might know of a way to directly access an element by its name, instead.

Here is the code that allows me to do it with ordinal index numbers:

ActiveDocument.XMLNodes(1).ChildNodes(1).Text

I've tried this, which doesn't work:

ActiveDocument.XMLNodes(1).ChildNodes("MyNode").Text

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top