O
Ole Streicher
Hi,
I have an XML file that looks like this:
<list>
<module name="einmodul">
<parameter="p1"/>
<file name="a.dat"/>
<file name="c.xml"/>
</module>
<module name="...">...</modules>
....
<file name="a.dat">
<type>Datenfile</type>
<format>XUS</format>
</file>
....
</list>
and I want to use this file to update a certain section of an existing
ms word document as follows:
Module einmodul
===============
List of parameters
- Parameter p1
Files:
+-------+-----------+--------+
| Name | Type | Format |
+-------+-----------+--------+
| a.dat | Datenfile | XUS |
| c.xml | Konfig | XML |
+-------+-----------+--------+
Module ...
==========
etc.
That means that I need to collect all information from the XML file
and include it into the Word document. I would like to use xpath
resp. xslt for the collection stuff since there I have some
experience, but I would use other ways, too.
How could I do this? I am an absolut newcomer to VBA/Word (not even a
Word user up to now...).
I could already create some VBA code that finds a bookmark and
replaces it by my own text. But, when I try to define an XML document
with
Dim myXmlDocument As XmlDocument
I get the error message
User-defined type not defined.
What is wrong there? I thought that Word 2003 can handle XML documents?
How should I proceed?
Best regards
Ole
I have an XML file that looks like this:
<list>
<module name="einmodul">
<parameter="p1"/>
<file name="a.dat"/>
<file name="c.xml"/>
</module>
<module name="...">...</modules>
....
<file name="a.dat">
<type>Datenfile</type>
<format>XUS</format>
</file>
....
</list>
and I want to use this file to update a certain section of an existing
ms word document as follows:
Module einmodul
===============
List of parameters
- Parameter p1
Files:
+-------+-----------+--------+
| Name | Type | Format |
+-------+-----------+--------+
| a.dat | Datenfile | XUS |
| c.xml | Konfig | XML |
+-------+-----------+--------+
Module ...
==========
etc.
That means that I need to collect all information from the XML file
and include it into the Word document. I would like to use xpath
resp. xslt for the collection stuff since there I have some
experience, but I would use other ways, too.
How could I do this? I am an absolut newcomer to VBA/Word (not even a
Word user up to now...).
I could already create some VBA code that finds a bookmark and
replaces it by my own text. But, when I try to define an XML document
with
Dim myXmlDocument As XmlDocument
I get the error message
User-defined type not defined.
What is wrong there? I thought that Word 2003 can handle XML documents?
How should I proceed?
Best regards
Ole