Create EXACT Duplicate of Current Doc - Inclyding pictures and tab

M

MDW

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.
 
D

Dave Lett

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top