Is there a way to move through a document until you find
text of a specific style (i.e. Header 1) and
then "capture" that text?

Re: Using VBA to look for Styles by Steve

Steve
Thu Nov 06 16:58:34 CST 2003

Hi Brian,
Here ya go...

Sub FindStyle
Dim strFound as String
With Selection.Find
.ClearFormatting
.Format = True
.Forward = True
.Style = "Header 1"
.Text = ""
.Execute
End With

if Selection.Find.Found then strFound = Selection.Text

End Sub



This captures the text of the named style into a string variable (strFound)
to do with what you will.



HTH and have a great day!



Steve Lang





"Brian" <anonymous@discussions.microsoft.com> wrote in message
news:035601c3a4b6$6d972150$a501280a@phx.gbl...
> Is there a way to move through a document until you find
> text of a specific style (i.e. Header 1) and
> then "capture" that text?