Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting Paras between two different Para Styles 1

Status
Not open for further replies.

harky

Technical User
Oct 29, 2001
39
GB
Does anyone know how I select the text between two different para styles. Basically, I have two different styles "[IPSB" which begins a section of inserted text, and "[IPSE" which ends the inserted text. I need to select everything between these two codes and format it. Can anyone help?
 
To get you started:

Sub test()
Dim oPara As Paragraph
Dim oNext As Paragraph

For Each oPara In ActiveDocument.Paragraphs
If oPara.Style = "Heading 1" Then
Set oNext = oPara.Next
Do While (Not oNext Is Nothing) And (Not oNext.Style = "Heading 2")
oNext.Range.Font.ColorIndex = wdBrightGreen
Set oNext = oNext.Next
Loop
End If
Next oPara
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top