Larry,
To make this work, you need two key pieces of information: a way to identify
the source paragraph and a way to identify the target location. The target
location should be easy enough since (I assume) you have full control over
the content of the "new" cover page (an AutoText entry or some such?). If so,
then you should be able to insert a bookmark at the target location and use
something like:
If ActiveDocument.Bookmarks.Exists("TargetBookmark") Then
ActiveDocument.Bookmarks("TargetBookmark").Range.Text = MySourceContent
This assumes that the bookmark in the target location is called
"TargetBookmark" and the cover page paragraph has been stored in a String
variable called "MySourceContent".
However, finding the paragraph in the "old" cover page to use to set the
value of "MySourceContent" may be a bit trickier. Is there something unique
about this paragraph that would allow you to identify it easily? For example,
is it always the first or fourth or tenth paragraph in the document? Or
perhaps it always starts with the same several words? Or maybe it has a
particular style associated with it? Or there's something special about the
paragraph before it (like it says "Title")?
For the sake of argument, let's say that it's always the third paragraph in
the document. In this case you could use something like:
MySourceContent = ActiveDocument.Paragraphs(3).Range.Text
Then after you run your code to replace the old cover page with the new one
(which contains the bookmark for identifying the target location), you call
the first bit of code I posted above.
If all else fails you could possibly do something like set the cursor
manually at the start of the source paragraph and then invoke your "cover
page replacement" routine from there. In this case, all you would need to do
is expand the selection to incorporate the entire paragraph (Selection.Expand
wdParagraph) and then use Selection.Range.Text to set the value of
"MySourceContent".
I'll have to leave it up to you to figure out how to uniquely identify the
source paragraph, but hopefully this will get you started. Post back if you
do find a way to ID the source para but can't work out how to get the content
via code.
--
Cheers!
Gordon Bentley-Mix
Word MVP
Please post all follow-ups to the newsgroup.
Read the original version of this post in the Office Discussion Groups - no
membership required!