PDA

View Full Version : copy cells from xml to word: loop through files



barolo
12-05-2006, 08:23 AM
Hi,

I am completely new to this, so please excuse any dumb statements or too many details. Through Stata (statistical software) I produce a number of xml files. The number of files produced depends on the number of various sites in my database. The names of the files are consistent and only differ based in the site id (site1.xml, site2.xml etc) and are placed in the same directory.

I need to copy the range of cells from each of these files and copy it into a table shell that I have created in word and save corresponding word files with names site1.doc, site2.doc etc. (The range of cells is always the same).

I don't care whether this is run from Word of from Excel. Can someone help me with this? Also, since the number of sites differs over time, is it possible to open every xml file in a particular directory and create a correspoding word table without specifying the precise range for the names of files.

Thank you very much.

barolo
12-06-2006, 08:10 AM
Hi,
Just to add some info to my previous post.
The speadsheet type data that I am placing into XML files, I can also place into tab-delimted text files instead of XML, if it makes things easier. So then the task becomes to create multiple Word files, each with a table that is filled in with the information from a corresponding text file.
Thanks a lot. Any advice on what's the best way to proceed is appreciated.