Length Line

P

PawelR

Hello group,
I'm beginner.
How make bold all line in document where line lenhth is more that 15
characters.

Thenk

PawelR
 
D

DA

HiPawel

Try the following:
'--------------------
Sub Example()
With Selection
.Expand Unit:=wdLine
If .Characters.Count > 15 Then _
.Font.Bold = True
End With
End Sub
'--------------------

Hope that helps,
Dennis
 
H

Helmut Weber

Hi Pawel,
---
With Selection
.ExtendMode = False
.HomeKey Unit:=wdStory
.EndKey Unit:=wdLine
While .Range.End <> ActiveDocument.Range.End - 1
If Len(.Bookmarks("\line").Range.Text) > 15 Then
.Bookmarks("\line").Range.Font.Bold = True
End If
.MoveDown
.EndKey Unit:=wdLine
Wend
End With
---
But I didn't put much effort in this, as it is
theoretically impossible, which you will see perhaps,
when executing the code.
I line may consist of 16 not bold characters.
After making them bold, the line may consist of
15 characters and should not be bold. If removing
bold, it will consist again of 16 characters....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top