![]() |
|
#1
|
|||
|
|||
![]()
I have some macros that are update the paragraph style, but now need a macro that can place an en-dash at the beginning of every paragraph.
|
#2
|
|||
|
|||
![]()
No need for VBA, you can do that with Find. Find paragraph marks and replace with a paragraph followed by an en-dash.
|
#3
|
|||
|
|||
![]()
As I mentioned, I'm going to incorporate this with other macros, so it would be nice to do this with a macro as well.
I recorded a macro and updated it to get this, but it skips the very first paragraph of the Word document. Code:
Sub Macro9() Selection.HomeKey Unit:=wdStory, Extend:=wdMove With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = "^p" .Replacement.Text = "^p ^= " .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub |
#4
|
||||
|
||||
![]()
Simple:
Code:
Sub Demo() Application.ScreenUpdating = False With ActiveDocument.Range.Find .ClearFormatting .Replacement.ClearFormatting .Execute FindText:="[!^13]@^13", ReplaceWith:="^=^&", _ MatchWildcards:=True, Format:=False, Wrap:=wdFindContinue, Replace:=wdReplaceAll End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
Thank you Paul. Works great.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Shelley Lou | Word VBA | 6 | 11-18-2024 03:15 PM |
![]() |
jeffreybrown | Word VBA | 1 | 05-08-2021 04:01 PM |
![]() |
village | Word | 3 | 07-20-2018 01:48 AM |
![]() |
Bobosmite | Word | 2 | 05-06-2011 04:21 AM |
Dash in the beginning of a new line | Wakinyan | Word | 0 | 07-11-2010 07:10 AM |