View Single Post
 
Old 10-14-2021, 02:46 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,967
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

This should work
Code:
Sub Find2Style()
  Dim aRng As Range
  Set aRng = ActiveDocument.Range
  With aRng.Find
    .Text = ""
    .Replacement.Text = ""
    .ClearFormatting
    .Style = ActiveDocument.Styles("Heading 2")
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .MatchCase = False
    If .Execute Then
      aRng.Start = 0
      aRng.Select
    Else
      MsgBox "Style not found"
    End If
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote