S
Sammy
Hi,
I have the following macro which looks for any paragraph formatted with
Heading 2 style and then underlines the text from the beginning of the
paragraph up until the first period (doesn't underline the period). For some
reason I get a compile error that says "Next without For" but as you can see
I have "Next". I'm trying to test my code to see if this works but I can't
get past this error. Thanks for any help.
Sub ProcessLev2()
Dim myPara As Paragraph
For Each myPara In ActiveDocument.Paragraphs
If myPara.Style = "Heading 2" Then
Selection.Collapse Direction:=wdCollapseStart
Selection.Extend
Selection.Extend Character:="."
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.Underline = wdUnderlineSingle
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Next myPara
End Sub
I have the following macro which looks for any paragraph formatted with
Heading 2 style and then underlines the text from the beginning of the
paragraph up until the first period (doesn't underline the period). For some
reason I get a compile error that says "Next without For" but as you can see
I have "Next". I'm trying to test my code to see if this works but I can't
get past this error. Thanks for any help.
Sub ProcessLev2()
Dim myPara As Paragraph
For Each myPara In ActiveDocument.Paragraphs
If myPara.Style = "Heading 2" Then
Selection.Collapse Direction:=wdCollapseStart
Selection.Extend
Selection.Extend Character:="."
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.Underline = wdUnderlineSingle
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Next myPara
End Sub