PDA

View Full Version : Copying all, not just content



p.goh
08-22-2012, 04:12 AM
I am using the following code to try and append 1 document to another:

<vbacode>
Set wordDocSrc = wordApp.Documents.Open(strWordDocSrc)
Set wordDocDest = wordApp.Documents.Open(strWordDocDest)

wordDocDest.content = wordDocDest.content & wordDocSrc.content
</vbacode>


The result of this is that it takes all the contents of tables and text boxes and puts this as standard text in the destination document. How do I retain objects like text boxes, tables etc?

thanks a load

snb
08-22-2012, 05:11 AM
sub snb()
with getobject("G:\OF\firstdocument.docx")
getobject("G:\OF\seconddocument.docx").content.copy
.Paragraphs.Last.Range.Paste
end with
end sub

p.goh
08-22-2012, 05:26 AM
that works an absolute treat. thank you very much