Prev: Merging cells in column
Next: Macro Needed
From: Rich Lawson on 7 May 2010 14:11 We are receiving thousands of documents which need to be reformated for page breaks and section break. These are batch files containing hundreds of documents which end with a Page Break followed by a Section Break(Continuous). To process these files, the Page Break/Section Break(Continuous) needs to be replaced with a Section Break(Next Page). Using vba and Word 2003 we have been able to do simple search and replace of the Page Break OR the Section Break(Continuous) but not the Page Break AND the Section Break(Continuous). Also, I can find no code for doing a Replace on the Section Break(Next Page). Rich Lawson Applications Developer AAM, LLC
From: Doug Robbins - Word MVP on 7 May 2010 18:50 Use: Dim i As Long With ActiveDocument For i = 2 To .Sections.Count .Sections(i).PageSetup.SectionStart = wdSectionNewPage Next i End With Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:="^m^b", Forward:=True, _ MatchWildcards:=False, _ Wrap:=wdFindContinue, MatchCase:=False) = True Selection.Collapse wdCollapseStart Selection.Delete Loop End With -- 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 "Rich Lawson" <nospam(a)nospam.com> wrote in message news:uhynGDh7KHA.5848(a)TK2MSFTNGP06.phx.gbl... > We are receiving thousands of documents which need to be reformated for > page breaks and section break. > > These are batch files containing hundreds of documents which end with a > Page Break followed by a Section Break(Continuous). > > To process these files, the Page Break/Section Break(Continuous) needs to > be replaced with a Section Break(Next Page). > > Using vba and Word 2003 we have been able to do simple search and replace > of the Page Break OR the Section Break(Continuous) but not the Page Break > AND the Section Break(Continuous). > > Also, I can find no code for doing a Replace on the Section Break(Next > Page). > > Rich Lawson > Applications Developer > AAM, LLC > >
From: Rich Lawson on 10 May 2010 13:29 Thank you. That works perfectly. I was close. I am glad I spent the time trying to solve it. Rich Lawson "Doug Robbins - Word MVP" <dkr(a)REMOVECAPSmvps.org> wrote in message news:uK$k0ej7KHA.5936(a)TK2MSFTNGP02.phx.gbl... > Use: > > Dim i As Long > With ActiveDocument > For i = 2 To .Sections.Count > .Sections(i).PageSetup.SectionStart = wdSectionNewPage > Next i > End With > Selection.HomeKey wdStory > Selection.Find.ClearFormatting > With Selection.Find > Do While .Execute(FindText:="^m^b", Forward:=True, _ > MatchWildcards:=False, _ > Wrap:=wdFindContinue, MatchCase:=False) = True > Selection.Collapse wdCollapseStart > Selection.Delete > Loop > End With > > > -- > 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 > > "Rich Lawson" <nospam(a)nospam.com> wrote in message > news:uhynGDh7KHA.5848(a)TK2MSFTNGP06.phx.gbl... >> We are receiving thousands of documents which need to be reformated for >> page breaks and section break. >> >> These are batch files containing hundreds of documents which end with a >> Page Break followed by a Section Break(Continuous). >> >> To process these files, the Page Break/Section Break(Continuous) needs to >> be replaced with a Section Break(Next Page). >> >> Using vba and Word 2003 we have been able to do simple search and replace >> of the Page Break OR the Section Break(Continuous) but not the Page Break >> AND the Section Break(Continuous). >> >> Also, I can find no code for doing a Replace on the Section Break(Next >> Page). >> >> Rich Lawson >> Applications Developer >> AAM, LLC >> >>
|
Pages: 1 Prev: Merging cells in column Next: Macro Needed |