A
Antigone
The macro I've written below does add a comment to Bold FlushHeads, and does
not insert comment when range is found in a table. However the macro takes a
long time to run because it hits on each cell in a table. I've spent a week
now rewritting it 20+ times with different logic. Such as if paragraph is in
a table go to end of table and continue, if not in a table and meets the
conditions add the comment etc. None of my attempts work. Can someone steer
me in the right direction?
Regards
~Antigone
------------------------------------------------------------------------------
-------
Sub findboldheadsFv11()
' works on getting all Bold Flushheads
' over 1 character but under 100
' and left aligned only
' and skips lines that already have comments
' and does not add comments to text in tables
Dim p As Integer
Dim para As Range
For p = 1 To ActiveDocument.Paragraphs.Count
ActiveDocument.Paragraphs(p).Range.Select
Set para = ActiveDocument.Paragraphs(1).Range
If (Not Selection.Range.Information(wdWithInTable)) And _
Selection.Font.Bold = True And _
Selection.Characters.Count < 100 And _
Selection.Characters.Count > 1 And _
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft And _
Selection.Comments.Count = 0 Then
Selection.Comments.Add Range:=Selection.Range, Text:="F"
End If
Next p
End Sub
not insert comment when range is found in a table. However the macro takes a
long time to run because it hits on each cell in a table. I've spent a week
now rewritting it 20+ times with different logic. Such as if paragraph is in
a table go to end of table and continue, if not in a table and meets the
conditions add the comment etc. None of my attempts work. Can someone steer
me in the right direction?
Regards
~Antigone
------------------------------------------------------------------------------
-------
Sub findboldheadsFv11()
' works on getting all Bold Flushheads
' over 1 character but under 100
' and left aligned only
' and skips lines that already have comments
' and does not add comments to text in tables
Dim p As Integer
Dim para As Range
For p = 1 To ActiveDocument.Paragraphs.Count
ActiveDocument.Paragraphs(p).Range.Select
Set para = ActiveDocument.Paragraphs(1).Range
If (Not Selection.Range.Information(wdWithInTable)) And _
Selection.Font.Bold = True And _
Selection.Characters.Count < 100 And _
Selection.Characters.Count > 1 And _
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft And _
Selection.Comments.Count = 0 Then
Selection.Comments.Add Range:=Selection.Range, Text:="F"
End If
Next p
End Sub