count 15 characters

S

Steved

Hello from Steved

Today and tomorrow

and leave

Today and tomorr

Using the above as an example how would I write a macro to Count 15
Characters including spaces and delete everything after the 16th. They are a
paragraph and they start at the begining The Paragraph only contains one line.

Thankyou.
 
J

Jean-Guy Marcil

Steved was telling us:
Steved nous racontait que :
Hello from Steved

Today and tomorrow

and leave

Today and tomorr

Using the above as an example how would I write a macro to Count 15
Characters including spaces and delete everything after the 16th.
They are a paragraph and they start at the begining The Paragraph
only contains one line.

Thankyou.

One of many ways:


Dim rgePara As Range

Set rgePara = Selection.Range.Paragraphs(1).Range

With rgePara
'Set range to unwanted part and _
Remove ¶ from range as we do not want to delete that
.SetRange .Start + 16, .End - 1
.Delete
End With


--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
S

Steved

Excellent

Thankyou.

Jean-Guy Marcil said:
Steved was telling us:
Steved nous racontait que :


One of many ways:


Dim rgePara As Range

Set rgePara = Selection.Range.Paragraphs(1).Range

With rgePara
'Set range to unwanted part and _
Remove ¶ from range as we do not want to delete that
.SetRange .Start + 16, .End - 1
.Delete
End With


--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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