I've got a Word 2003 document that contains a lot of embedded pictures and
tables. I'm trying to write a macro that will make new document that is an
exact duplicate of the first couple of pages, down to the formatting and
containing all the pictures and whatnot.
Below is the code that grabs the first couple of pages. However, it doesn't
seem to work right:
Set objDoc = ThisDocument
Set objNew = Application.Documents.Add
objNew.PageSetup = objDoc.PageSetup
Set objRG = objDoc.Range(0, lngEnd)
objNew.Content.InsertBefore objRG
Set objNew = Nothing
Set objDoc = Nothing
"lngEnd" is a variable that represents the character at the very end of the
last page I want to copy.
What happens is that the text part is transferred over, but it doesn't bring
over the pictures, the tables, etc. Also, any text effects (font size, bold,
etc) aren't translated. Plus it adds a lot of extra pages.
Obviously this is not the right technique to do this kind of thing....what
do I need to change??
TIA.

Signature
Hmm...they have the Internet on COMPUTERS now!
Dave Lett - 16 Aug 2006 21:21 GMT
Try this instead:
In the original document, insert a bookmark at the location where you want
to have the exact replica document END.
Then include the following in your routine:
Dim oRng as Range
ActiveDocument.SaveAs FileName:="Replica"
Set oRng = ActiveDocument.Range _
(Start:=ActiveDocument.Bookmarks("ReplicaEnd").Range.Start, _
End:=ActiveDocument.Range.End)
oRng.Delete
HTH,
Dave
> I've got a Word 2003 document that contains a lot of embedded pictures and
> tables. I'm trying to write a macro that will make new document that is an
[quoted text clipped - 30 lines]
>
> TIA.
Jezebel - 17 Aug 2006 00:14 GMT
Why not just save a copy of the old document and delete what you don't want?
> I've got a Word 2003 document that contains a lot of embedded pictures and
> tables. I'm trying to write a macro that will make new document that is an
[quoted text clipped - 30 lines]
>
> TIA.
MDW - 17 Aug 2006 17:08 GMT
Because I'm....an idiot? *LOL*
Thanks.

Signature
Hmm...they have the Internet on COMPUTERS now!
> Why not just save a copy of the old document and delete what you don't want?
>
[quoted text clipped - 32 lines]
> >
> > TIA.