View Single Post
 
Old 05-17-2018, 02:00 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,161
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 macro will help you standardise your document's hanging indents AND makes use of styles. It will greatly reduce inconsistency in your styling of the document because it is resetting the paragraph formats and removes local paragraph overrides.
Code:
Sub AllStylesSetHanging()
  Dim aStyle As Style
  For Each aStyle In ActiveDocument.Styles
    If aStyle.Type = wdStyleTypeParagraph Then
      If aStyle.ParagraphFormat.FirstLineIndent < 0 Then
        aStyle.ParagraphFormat.FirstLineIndent = -CentimetersToPoints(1)
        If aStyle.ParagraphFormat.LeftIndent < CentimetersToPoints(1) Then
          aStyle.ParagraphFormat.LeftIndent = CentimetersToPoints(1)
        End If
      End If
    End If
  Next aStyle
  ActiveDocument.Range.ParagraphFormat.Reset
End Sub
Whilst we could choose to write the macro differently to deal with local settings on every paragraph, that macro would run very slowly and result in a poorly formatted file which is why you have had pushback on your asked-for approach.
If you see other non-hanging paragraphs change as a result of this macro, you should apply the right styles to those paragraphs.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote