From: zikkio on 29 Mar 2010 12:04 Hi all, I need to merge a document into another, preserving portrait/landscape page layout of the source doc. I've noticed that a simple copy&paste from a word window to the other does exactly what I need, but the same thing done via vbscript doesn't work: the content of the original document is pasted into the output doc, the section break is present but the page formatting is lost. I've tried also a direct inserting of the file with Selection.InsertFile method, but the result is the same (document inserted, section break inserted, page orientation lost). I'm using word 2003 sp3. Any help will be appreciated. TIA, zikkio
From: Doug Robbins - Word MVP on 29 Mar 2010 17:30 Show us the code that you are using. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "zikkio" <gianluca.zani(a)gmail.com> wrote in message news:9138d1bb-6b3d-45db-8b4f-348178a8d816(a)g4g2000yqa.googlegroups.com... > Hi all, > > I need to merge a document into another, preserving portrait/landscape > page layout of the source doc. > I've noticed that a simple copy&paste from a word window to the other > does exactly what I need, but the same thing done via vbscript doesn't > work: the content of the original document is pasted into the output > doc, the section break is present but the page formatting is lost. > I've tried also a direct inserting of the file with > Selection.InsertFile method, but the result is the same (document > inserted, section break inserted, page orientation lost). > > I'm using word 2003 sp3. > > Any help will be appreciated. > > TIA, > zikkio
From: zikkio on 30 Mar 2010 03:24 Hi Doug, here it is the code. First attempt, with copy&paste from one word doc to the other: 'Opening the cover, copy and paste to the document WordCover = Cover.Documents.Open(theCover.FileName) Cover.ActiveDocument.select Cover.selection.copy objSelection.paste Cover.Quit false objSelection.InsertBreak 2 And this is the second attempt, with InsertFile: objSelection.InsertFile theCover.FileName, , False, False, False objSelection.InsertBreak 2 In both sample, objSelection is a Selection object taken from the ActiveDocument of the destionation doc (word.application object). Many thanks, zikkio
|
Pages: 1 Prev: Remove Menu Ribbon Tab Next: Including paragraph text into filename |