Problem with Range.Text

N

Neo

Hello All,

I want to get text in Range object. But I am also interested in
numbered list formatting. e.g. if text is

1. x
2. y

I want it to be as above. Althoug Range.Text gives me only
x
y

I realized if I save it in text file I can get numbers. Also, I figured
out copy /paste preserves numbered list.

but I am looking for something elegant. Is there any way to get Text in
range with numbered list data???

Best Regards,
Pravin A. Sable
 
J

Jezebel

Explore the range's ListFormat object. ListNumber gives you the absolute
number; ListString gives you the number as actually displayed.

If your Range includes more than one paragraph, the properties show the
values for the first paragraph; or you can iterate the Range's
ListParagraphs collection.
 
N

Neo

Thaks it worked!

Dim para As Paragraph
Dim paras As Paragraphs

Set paras = r.Paragraphs
Dim sLine As String
Dim i As Integer
i = 1
Do While i <= paras.Count
Set para = paras(i)

sLine = sLine & para.Range.ListFormat.ListString & " " &
para.Range.Text
i = i + 1
Loop
 

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