I
Ian Jaffray
Hello,
To recreate this, create a new doc based on normal.dot, put in a few
characters of text and style them with, for example, Heading 2. The record a
macro of using Find to find the style Heading 2. Close the macro, then run
it on the same document in VBA.
After that, open the Find dialog in Word. On the Find tab, where it says
"Find what:", Format will read:
"Style: Heading 2, Border: Top (Single solid line, Auto, 0.75 pt Line
width)..."
Heading 2 does not have a Border Top property matching that, confirmed by
simple visual inspection and the "Reveal Formatting" properties.
If you immediately try and run the Find operation from the dialog, it fails
to find the text styled with Heading 2.
Does anyone know why the anomalous info is appearing in the Find dialog, or
why the macro of the recorded Find op is failing?
Thanks for your help,
Ian J.
The macro that gets created for the simple Find op is:
Sub Macro121()
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Heading 2")
Selection.Find.ParagraphFormat.Borders.Shadow = False
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
End Sub
To recreate this, create a new doc based on normal.dot, put in a few
characters of text and style them with, for example, Heading 2. The record a
macro of using Find to find the style Heading 2. Close the macro, then run
it on the same document in VBA.
After that, open the Find dialog in Word. On the Find tab, where it says
"Find what:", Format will read:
"Style: Heading 2, Border: Top (Single solid line, Auto, 0.75 pt Line
width)..."
Heading 2 does not have a Border Top property matching that, confirmed by
simple visual inspection and the "Reveal Formatting" properties.
If you immediately try and run the Find operation from the dialog, it fails
to find the text styled with Heading 2.
Does anyone know why the anomalous info is appearing in the Find dialog, or
why the macro of the recorded Find op is failing?
Thanks for your help,
Ian J.
The macro that gets created for the simple Find op is:
Sub Macro121()
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Heading 2")
Selection.Find.ParagraphFormat.Borders.Shadow = False
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
End Sub