Help in writing Word Macro!
Hi All,
I am planning to accomplish following:
I have several documents named like
"section1.doc"
"section2.doc"
"section3.doc"
.
...
....
"section10.doc"
What I want to do is take input from user about which sections he wants to have in the final document. Say user enters section1, section5 and section7.
Then I want to create a document which will be a merged copy of section1.doc, section5.doc and section7.doc.
I am not able to get this done using Word Macro. I tried looking in Merge methods but they are not offering what I am looking for.
Any help will be really appreciated!
JD
http://jdk.phpkid.org
JD
Friday, December 5, 2003
Check out:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrconwordobjectmodeloverview.asp
(tiny url equivalent: http://tinyurl.com/xty5 )
Start with the object model overview link. Also, I find that often I can just record a macro while stepping through a process manually, and that gets me 90% there.
Nick
Friday, December 5, 2003
JD,
The easiest way to do this is to create a master document with each of your documents as sub-documents.
Then iterate through the sub-documents merging them into the master.
Look for the following in Word's help:
'Convert a subdocument into part of the master document'
I can't remember the exact object model off the top of my head, but you should have everything you need after recording a few steps and viewing the VBA generated.
Ged Byrne
Friday, December 5, 2003
Hi Ged,
The master/sub documents idea is nifty! I have started coding the macro and it looks like it fits the bill!
Thanks for pointers!
JD
JD
Friday, December 5, 2003
You should see a programmer and get proper Programming Advice.
IANAP
Professional Person
Friday, December 5, 2003
Professional Person,
YANAP?
Almost everybody else around here is.
Ged Byrne
Saturday, December 6, 2003
Recent Topics
Fog Creek Home
|