Re: Bold every second line
- From: Kanga 85 <Kanga85@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 3 Jan 2009 00:53:00 -0800
Thanks Macropod,
Very helpful
"macropod" wrote:
Hi Kanga,.
In case you've got line-feeds at the end of each logical line, try something along the lines of:
Sub LineFormatter()
Dim oRng As Range
Dim i As Long
With ActiveDocument
With .Content.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "^l"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
For i = 1 To .Paragraphs.Count
If i Mod 2 = 0 Then
.Paragraphs(i).Range.Bold = True
Else
.Paragraphs(i).Range.Bold = False
End If
Next i
With .Content.Find
.Text = "^p"
.Replacement.Text = "^l"
.Execute Replace:=wdReplaceAll
.Text = "^l^p"
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With
End With
End Sub
--
Cheers
macropod
[MVP - Microsoft Word]
"Kanga 85" <Kanga85@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:B5329F24-1109-4E7A-AA17-B37D3E25F855@xxxxxxxxxxxxxxxx
Thanks Graham,
I actually want lines rather than paragraphs, but I should be able to modify
your macro (or my docu,ment).
"Kanga 85" wrote:
I have a long list, and would like to bold every second line of the whole
document. I need a macro because new entries will be inserted at various
points and so muck up any original formatting.
Thanks in advance,
- References:
- Bold every second line
- From: Kanga 85
- RE: Bold every second line
- From: Kanga 85
- Re: Bold every second line
- From: macropod
- Bold every second line
- Prev by Date: Re: Bold every second line
- Next by Date: Re: format part of a TextBox content
- Previous by thread: Re: Bold every second line
- Next by thread: RE: Unable to get complete word doc for second time using VBA from PPT
- Index(es):
Relevant Pages
|