Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general
|
|||
|
|||
Automate Section Break
Does anybody have VBA code that can show me how to combine documents. I
will be using a consistent set of styles between them. I simply want to combine them in VBA code. I have tried the following: With Documents(DocCombine).Content .Collapse wdCollapseEnd '.InsertBreak Type:=wdSectionBreakContinuous .InsertBreak Type:=wdPageBreak .FormattedText = ActiveDocument.Content.FormattedText End With Note that the .InsertBreak Type:=wdSectionBreakContinuous line is commented out because I could not get the section information (such as margins) to stay unless I put the Section Break in the document. But I am getting strange results. My continuous section breaks are turning into page break section breaks. Any better code to do this? Thank You! Derek Hart |
#2
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general
|
|||
|
|||
Automate Section Break
Instead of inserting a continuous section break and a page break, why not
just insert a next page section break Dim myrange As Range DocCombine.Range.InsertBreak wdSectionBreakNextPage Set myrange = DocCombine.Range myrange.Start = myrange.End myrange.FormattedText =ActiveDocument.Range.FormattedText -- 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 "Derek Hart" wrote in message ... Does anybody have VBA code that can show me how to combine documents. I will be using a consistent set of styles between them. I simply want to combine them in VBA code. I have tried the following: With Documents(DocCombine).Content .Collapse wdCollapseEnd '.InsertBreak Type:=wdSectionBreakContinuous .InsertBreak Type:=wdPageBreak .FormattedText = ActiveDocument.Content.FormattedText End With Note that the .InsertBreak Type:=wdSectionBreakContinuous line is commented out because I could not get the section information (such as margins) to stay unless I put the Section Break in the document. But I am getting strange results. My continuous section breaks are turning into page break section breaks. Any better code to do this? Thank You! Derek Hart |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Table of Contents Swallows Section Break | Microsoft Word Help | |||
Section Breaks Question: Inserts a Continuous section break - why? | Microsoft Word Help | |||
Cannot delete a Section Break | Microsoft Word Help | |||
section break in master document | Formatting Long Documents | |||
FIrst page footers | Microsoft Word Help |