I need to change all of the headings in the books I am working on to "Heading 1".
So far, I've got this from recording changing two find and replaces:
'
' fixHeadings Macro
'
'
Selection.Find.ClearFormatting
With Selection.Find.ParagraphFormat
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
End With
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("Heading 1")
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
With Selection.Find.ParagraphFormat
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
End With
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("Heading 1")
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
I tried this, but I'm kinda lost when it comes to vba
Dim objDoc As Document
'
' test Macro
' test
'
If objStyle <> "Normal" Or "" Then Set objStyle = "Heading 1"
End Sub
This is sorta what I'm trying to do: "If style doesn't equal Normal or has no style then set the style to Heading 1"
Any ideas?