|
|
Question : Word VBA how to find/delete pge breaks
|
|
I can insert page breaks in a Word document using VBA. I want now to find and delete a break. But I don't find any collection in the Object Model that contains such breaks. Is there a way to find (and delete) a page break?
|
Answer : Word VBA how to find/delete pge breaks
|
|
I think you used the following syntax to insert the page break
Selection.InsertBreak Type:=wdPageBreak
To find a page break using vba
Selection.HomeKey Unit:=wdStory Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^m" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute replace:=wdreplaceall
^m is a character is used to find a page break. I think this will help you
Rams
|
|
|
|