How to parse XML from a VBA macro 
Author Message
 How to parse XML from a VBA macro

Hello,

I would like to write a Word macro which can read and parse an XML file and
generate Word content from it. The idea is to be able to write documentation
in XML and generate both Word content and HTML from it.

Does anyone know of a way of doing this? Can MSXML be used from VBA for
example? Or has anyone written any VBA subroutines for parsing XML that
they'd be willing to share?

Thanks in advance,

Colin Caughie



Sun, 21 Mar 2004 20:58:33 GMT  
 How to parse XML from a VBA macro
Hi Colin,
If you're doing a one-way transfer into Word it should be
rather easy.  If you don't have any Word-specific
formatting needs, you might create an XSLT to transform
the XML into HTML then just pull the HTML into Word.  You
could even do that dynamically if you want.  I have to
populate CustomDocumentProperties to store the metadata in
Word, if you need that, you'll probably have to use the
DOM to pull the XML info into Word.  Just set a reference
inside VBA to the XML parser of choice and open up the
document.  Something like this:
Public xmlDoc As New MSXML.DOMDocument
xmlDoc.Load (XMLDOCLOCATION)

Dim paras As MSXML.IXMLDOMNodeList
Set paras = metaHelp.getElementsByTagName("para")

presumably you know how to use the DOM to actually stuff
the info into the WOM?  

Hope this helps,
--tim

Quote:
>-----Original Message-----
>Hello,

>I would like to write a Word macro which can read and

parse an XML file and
Quote:
>generate Word content from it. The idea is to be able to
write documentation
>in XML and generate both Word content and HTML from it.

>Does anyone know of a way of doing this? Can MSXML be
used from VBA for
>example? Or has anyone written any VBA subroutines for
parsing XML that
>they'd be willing to share?

>Thanks in advance,

>Colin Caughie

>.



Sun, 21 Mar 2004 22:37:39 GMT  
 How to parse XML from a VBA macro
Yes, you got it. Use the MSXML parser. It's a COM object and totally
callable from VBA. See the microsoft docs online.


Quote:
> Hello,

> I would like to write a Word macro which can read and parse an XML file
and
> generate Word content from it. The idea is to be able to write
documentation
> in XML and generate both Word content and HTML from it.

> Does anyone know of a way of doing this? Can MSXML be used from VBA for
> example? Or has anyone written any VBA subroutines for parsing XML that
> they'd be willing to share?

> Thanks in advance,

> Colin Caughie



Mon, 22 Mar 2004 04:29:40 GMT  
 How to parse XML from a VBA macro

Quote:

> Hello,

> I would like to write a Word macro which can read and parse an XML file and
> generate Word content from it. The idea is to be able to write documentation
> in XML and generate both Word content and HTML from it.

> Does anyone know of a way of doing this? Can MSXML be used from VBA for
> example? Or has anyone written any VBA subroutines for parsing XML that
> they'd be willing to share?

Take a look at the documentation in the Microsoft XML SDK. It can be
downloaded here: http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample...
 It has a very good help file in the doc directory.


Mon, 22 Mar 2004 04:52:19 GMT  
 How to parse XML from a VBA macro
You can use MSXML from VBA very easily.
However, the easiest way to get into Word from XML is to use XSLT to convert the
XML into Word2000 HTML with XML islands, and then open that using MS-Word 2000.

On Wed, 3 Oct 2001 13:58:33 +0100, "Colin Caughie"

Quote:

>I would like to write a Word macro which can read and parse an XML file and
>generate Word content from it. The idea is to be able to write documentation
>in XML and generate both Word content and HTML from it.

>Does anyone know of a way of doing this? Can MSXML be used from VBA for
>example? Or has anyone written any VBA subroutines for parsing XML that
>they'd be willing to share?

--
Eoin Campbell, Technical Director, XML Workshop Ltd,
10 Greenmount Industrial Estate, Harolds Cross, Dublin 12, IRELAND.

Phone: +353 1 4547811; Fax: +353 1 4731626
Web: http://www.xmlw.ie/


Sat, 27 Mar 2004 21:19:48 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Parse external XML file in VBA

2. Parsing XML from an ASP page that Creates XML fails

3. Updating content with a VBA macro using XML

4. Using a VBA Macro to copy a VBA Macro

5. XML Parse

6. Starting external application from Word/Parsing XML

7. XML parsing in .net

8. how to parse wml (xml) files

9. XML Parse

10. vb.net newbie needs help with basic XML parsing

11. Parse RSS XML files (news feeds)

12. Reading/parsing an XML file into VB.

 

 
Powered by phpBB® Forum Software