#1
|
|||
|
|||
Paragraph Dialog: No Space Between Paragraphs of Same Style
I have been working on the following macro to unselect 'NoSpaceBetweenParagraphsOfSameStyle' for all paragraphs (text and footnotes), but the code does not work correctly. Please help! Thanks! Quote:
|
#2
|
|||
|
|||
Hi! I think you will find the answers here:
Style.NoSpaceBetweenParagraphsOfSameStyle Always Returning False? and NoSpaceBetweenParagraphsOfSameStyle Using Graham Mayor's advice, I've slightly changed your code and it seems to work: Sub NoSpaceBetweenPar() Dim aRng As range, iType As Integer Dim Para As Paragraph On Error GoTo Leave 'if no footnotes For iType = 1 To 2 Set aRng = ActiveDocument.StoryRanges(iType) For Each Para In aRng.Paragraphs Para.Style.NoSpaceBetweenParagraphsOfSameStyle = False Next Para Next iType Leave: End Sub |
#3
|
||||
|
||||
This setting belongs in the paragraph style so you should be looping through the styles and doing this to all paragraph styles.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#4
|
|||
|
|||
Thanks a lot to both of you for your comments! However, Vivka's new code does not work for me. Any idea?
|
#5
|
|||
|
|||
Hi! It's almost incredible. Vivka's code sometimes works and sometimes doesn't. No other way to do it? With 'Content'? Thanks!
|
#6
|
|||
|
|||
Hi, RobiNew! Sorry but I have no other ideas than trying replacing
For Each Para In aRng.Paragraphs with For Each Para In ActiveDocument.range.Paragraphs. |
#7
|
|||
|
|||
Sorry, no improvement. It never worked. The other sometimes did.
|
#8
|
|||
|
|||
Hi Vivka! The code here below works ALWAYS. Thank you for your suggestions!
Quote:
|
#9
|
|||
|
|||
Hi, RobiNew, and thank you for sharing your workable code! It's nice to learn something new!
|
Tags |
dialog, paragraphs, space |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Remove extra space before a paragraph and return it to previous paragraph | laith93 | Word VBA | 7 | 04-27-2022 08:26 AM |
a macro to replace paragraph mark with a space applies effect on paragraph marks after the selection | drrr | Word VBA | 2 | 08-24-2021 03:05 AM |
In 2010 document set for no space between paragraphs, but getting large space. | normancamp | Word | 10 | 12-25-2017 04:54 PM |
"Don't add space between paragraphs of the same style" within tables | WordUser789 | Word Tables | 3 | 12-17-2017 05:02 PM |
Allowing space between paragraphs of same style | jjmclell | Word VBA | 4 | 04-02-2015 06:44 AM |