Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 05-17-2018, 02:00 PM
Guessed's Avatar
Guessed Guessed is offline Macro for paragraphs with numbering and hanging Windows 10 Macro for paragraphs with numbering and hanging Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating hyperlinks in a document where clauses are deleted and auto numbering of paragraphs change Angela Jackson Word 2 03-21-2018 02:42 AM
Macro for paragraphs with numbering and hanging Macro to hide all paragraphs that do not have the found result jplat Word VBA 1 09-10-2017 09:13 PM
Continue Numbering Paragraphs PJinNH Word 5 03-15-2017 04:10 PM
Macro for hanging indent and single space pbishop Word 2 09-11-2016 06:49 PM
Macro for paragraphs with numbering and hanging Macro that changes color of all indented paragraphs muiy Word 4 08-01-2016 08:18 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:48 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft