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