Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I have recorded a macro in Word 2003 which removes two consecutive paragraph
marks and replaces them with one paragraph mark formatted with 12 pt sapcing afte. This works fine, but it also puts a border round the text, which I did not actually specify. However, when I looked at the macro, this is what I found: Sub InsertSpacingAfter() ' ' InsertSpacingAfter Macro ' Replaces consecutive paras with spacing after ' Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find.Replacement.ParagraphFormat .SpaceBeforeAuto = False .SpaceAfter = 12 .SpaceAfterAuto = False .LineUnitAfter = 0 End With Selection.Find.Replacement.ParagraphFormat.Borders .Shadow = False With Selection.Find .Text = "^p^p" .Replacement.Text = " ^p" .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 am not au fait with VB, so how do I edit the macro so that it will not put in the border, I tried just deleting 'Borders.Shadow, but it did not work. Thank you, |
#2
![]() |
|||
|
|||
![]()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting With Selection.Find.Replacement.ParagraphFormat .SpaceAfter = 12 End With With Selection.Find .Text = "^p^p" .Replacement.Text = " ^p" .Forward = True .Wrap = wdFindAsk .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute replace:=wdReplaceAll Will do what you want, but applying a spaced paragraph style to the text would be more elegant than adding a manual paragraph format attribute. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Misha wrote: I have recorded a macro in Word 2003 which removes two consecutive paragraph marks and replaces them with one paragraph mark formatted with 12 pt sapcing afte. This works fine, but it also puts a border round the text, which I did not actually specify. However, when I looked at the macro, this is what I found: Sub InsertSpacingAfter() ' ' InsertSpacingAfter Macro ' Replaces consecutive paras with spacing after ' Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find.Replacement.ParagraphFormat .SpaceBeforeAuto = False .SpaceAfter = 12 .SpaceAfterAuto = False .LineUnitAfter = 0 End With Selection.Find.Replacement.ParagraphFormat.Borders .Shadow = False With Selection.Find .Text = "^p^p" .Replacement.Text = " ^p" .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 am not au fait with VB, so how do I edit the macro so that it will not put in the border, I tried just deleting 'Borders.Shadow, but it did not work. Thank you, |
#3
![]() |
|||
|
|||
![]()
Thank you, That worked.
I need the macro because I often get documents I have to format which have two consecutiveparagraph marks to give spacing between paragraphs. Quite a lot of people who use Word don't seem to know the use of Spacing After! Thanks again "Graham Mayor" wrote: Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find.Replacement.ParagraphFormat .SpaceAfter = 12 End With With Selection.Find .Text = "^p^p" .Replacement.Text = " ^p" .Forward = True .Wrap = wdFindAsk .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute replace:=wdReplaceAll Will do what you want, but applying a spaced paragraph style to the text would be more elegant than adding a manual paragraph format attribute. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Misha wrote: I have recorded a macro in Word 2003 which removes two consecutive paragraph marks and replaces them with one paragraph mark formatted with 12 pt sapcing afte. This works fine, but it also puts a border round the text, which I did not actually specify. However, when I looked at the macro, this is what I found: Sub InsertSpacingAfter() ' ' InsertSpacingAfter Macro ' Replaces consecutive paras with spacing after ' Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find.Replacement.ParagraphFormat .SpaceBeforeAuto = False .SpaceAfter = 12 .SpaceAfterAuto = False .LineUnitAfter = 0 End With Selection.Find.Replacement.ParagraphFormat.Borders .Shadow = False With Selection.Find .Text = "^p^p" .Replacement.Text = " ^p" .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 am not au fait with VB, so how do I edit the macro so that it will not put in the border, I tried just deleting 'Borders.Shadow, but it did not work. Thank you, |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
New macro in Word | Microsoft Word Help | |||
Turning off Line Numbering Macro unformats my document! | Page Layout | |||
Save As is not working due to macro security settings | Microsoft Word Help | |||
macro help | Microsoft Word Help | |||
2000 to 2002 macro and "Could not open macro storage" | Mailmerge |