"gregarican" <greg.kujawa / gmail.com> wrote in message 
news:c03df6e7-e4f6-4f12-9aa7-bf03921455b4 / o4g2000pra.googlegroups.com...
On Jan 17, 11:18 am, Phlip <phlip2... / gmail.com> wrote:
> Robert Klemme wrote:
> > I'd do it with VB from inside Word. An alternative might be to use
> > OpenOffice, read the word, write OO's format (XML in ZIP) and the
> > manipulate the XML. But this sounds pretty awkward.
>
> I suspect Word can also barf out an XML representation.
>
> It may be awkward (get ready for the horror when you open that file!), but 
> it's
> probably the best way. All word processing is heading towards XML for its
> interoperability.

I wound up writing a C# console program to do the work. I just
referred to ugly underbelly of all of the Word COM stuff and was able
to grab what I needed. It took awhile though, since my text was
contained within text frames. So I had to work with the
Document.Shapes property and whatnot.

In searching for a solution I did run across a VBA code snippet that
would save off each document separately after the mail merge
completed. At least now I have a totally automated solution, although
it's cobbled together from various sources. First I pull my data from
a SQL DB using Ruby, dumping that to an Excel data source. Then I have
a C# program that takes that data source, uses a Word mail merge
template and delivers the final document set. Finally, I have a Ruby
program that looks in that save directory and e-mails the documents to
the individual employees. Eventually it'd be a lot cleaner and easier
to maintain if I had all of the work done in a single program written
in a single language. But that's another fight for another day :-)



<JS>
Well, if anybody can figure this out, it's you.

</JS>