A
Access101
I would like to insert a page break before any paragraph that has a style
starting with "Heading". This code Inserts XXPBXX and is later
search/replaced by a page break. This code runs very slow, and there must be
an easier way.
Dim doc As Document
Set doc = ActiveDocument
pCount = doc.Paragraphs.Count
Application.ScreenUpdating = False
For p = 1 To pCount
If Left(doc.Paragraphs(p).Style, 7) = "Heading" Then
doc.Paragraphs(p).Range.Select
Selection.InsertBefore "XXPBXX"
End If
Next
Application.ScreenUpdating = True
starting with "Heading". This code Inserts XXPBXX and is later
search/replaced by a page break. This code runs very slow, and there must be
an easier way.
Dim doc As Document
Set doc = ActiveDocument
pCount = doc.Paragraphs.Count
Application.ScreenUpdating = False
For p = 1 To pCount
If Left(doc.Paragraphs(p).Style, 7) = "Heading" Then
doc.Paragraphs(p).Range.Select
Selection.InsertBefore "XXPBXX"
End If
Next
Application.ScreenUpdating = True