Automate appending of a MS Word Doc to another

Automate appending of a MS Word Doc to another

Post by mccolingra » Wed, 26 Nov 2003 01:30:35

I have two word docs, and I want to automate the insertion of doc2.doc
to the end of doc1.doc. So from the _command line_ I'd like to know
how I could:
1) start up doc1 (that part I know)
2) Automatically (through a macro?):
jump to the end of doc1 (I won't know how many pages there will
Insert a page break
Insert doc2
I can do all that by hand, but i need a way to automatate this task.
(The files are actually in a database on a unix server, and the users
will pick the files from within the database application. I can copy
the files over to the Windows machine, but how to combine them so the
user sees the combination of the two when MS Word kicks in?)

FYI, I figured this out.
I turned on macro recording while I was in a file, and recorded the
commands to jump to the end of the file (Ctrl-End), create a page
break (Ctrl-Enter), and read in a new file (doc2.doc) from the C:\Temp
folder. I saved the macro in the default .dot template (macro name
"AppendDoc") so it would be available in all my word docs.
Then, from the command line (or from within a .bat file), I could call
up any file (say thisdoc.doc) with the following command, and it
automatically appended C:\Temp\doc2.doc to it.

"C:\Program FIles\Microsoft Office2000\Office\winword.exe" thisdoc.doc

(that's all on one line)