Is the bullet of a list considered to be a range?

R

rVo

Is the bullet of a list considered to be a range? And how do I check if a
certain range is actually the bullet of a list?
 
H

Helmut Weber

Hi,

the bullet, the liststring-character,
seems not to be a real character in a way.

Create a new doc,
type 0123456789,
format this only paragraph as bulleted.


Try:
Dim rTmp As Range
Set rTmp = ActiveDocument.Range
MsgBox rTmp.Characters.Count '11
MsgBox rTmp.Characters(1) ' 0
rTmp.SetRange 0, 1
MsgBox rTmp.Text ' 0

What do you want to do actually?

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
R

rVo

I wrote code that has to make sure that all text in a document is in a
desired font.
If not, I change it to this font. This works ok, but if I encounter a range
that has a bullet (which often is a symbol, wingdings, etc... character) it
will turn the bullet into the desired font as well, leaving it
unrecognisable and ugly.

So in short: I'm looking for a way to preserve the font setting of the
bullet of a bulleted range.

Thanks for your interest.

rVo
 
R

rVo

I tried the following: (comment-signs at start of each line are to keep our
paranoid FireWall busy :)

' Dim pr As Paragraph
' For Each pr In ActiveDocument.Paragraphs
' If pr.Range.Font.Name = "" Then 'this means the
listitemtext has a bullet in a different font then the listitem itself
' If pr.Range.ListFormat.CountNumberedItems = 0 Then
'it's not a number bullet
' pr.Range.ListFormat.ApplyBulletDefault 'set the
standard bullet for the document for this list item
' If pr.LeftIndent > 0 Then ' this seems to
increase the indent with 1, just checkin to avoid error
' pr.Outdent 'lower the indent
' End If
' pr.Range.Font.Name = "Times New Roman"
' End If
' End if
' Next pr

The problem with this code (appart from the ugly mess with indents) is that
the original bullet is kept as well, so I end up with 2 bullets!
 
H

Helmut Weber

Hi rVo,

umm..., this could become a long story.
Don't expect too much at once.

It seems, that you are not searching for genuine listparagraphs,
but for paragraphs where probably a bullet and a tab
were inserted manually at the start of the paragraph.

To check this, try:

'Sub CheckList()
'Dim l As Long
'With ActiveDocument.ListParagraphs
' For l = 1 To .Count
' .Item(l).Range.Select
' Next
'End With
'End Sub

If my assumption is right, then you have as a first step
to find paragraphs, which start with a bullet and a tab.

This is easier said than done, as the bullet character
may not reveal it's font name just like that, when not formatted
directly, but inserted via the dialog "insert symbol".

Before I continue further, is my assumption right?

And one remark more:
....Range.Font.Name returns "" if there is a character
somewhere in the range with a font different from some
other character's font in the range. Could be, that the bullet
is the cause for this, but you'll never know.

Don't give up.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
R

rVo

Thanks Helmut,
The problem is: I'm not sure what I'm looking for because I need to create a
report based on documents which were created by a number of different
authors, each using Word up to his/her possibilities. The have a template to
write their text in, this should result in decent lists with a correct font
and a nice bullet. But the problem with Word is that you can do things in
many different ways, including bulleted lists. So it seems to happen that
some paragraph which obviously is a bulleted list acually is some
handcrafted lookalike and that is (one of the many situations :) when
things start to go wrong.

Actually I'm not really interested in the bullet's font, I might change
every bullet to a certain symbol as well. This way I avoid a lot of
difficulties but there should still be a possibility to have different
levels in the lists and ofcourse use a different bullet for each level.
 
H

Helmut Weber

Hi rVo,
The problem is: I'm not sure what I'm looking for

May I quote my old Professor H.-G. Tillmann:
"Where everything is possible, nothing is possible"

With a mixture of handcrafted lookalikes of listparagraphs
and genuine listparagraphs, you are at a loss.

You will end up with a project with the following outlines,
not knowing if there is a solution at all.

Sub testdunno()
' wdListNoNumbering ' 0
' wdListListNumOnly ' 1
' wdListBullet ' 2
' wdListSimpleNumbering ' 3
' wdListOutlineNumbering ' 4
' wdListMixedNumbering ' 5
' wdListPictureBullet ' 6
Dim oPrg As Paragraph
Dim rTmp As Range
For Each oPrg In ActiveDocument.Paragraphs
Set rTmp = oPrg.Range
If rTmp.ListParagraphs.Count = 1 Then
Select Case rTmp.ListFormat.ListType
Case 1: ' lots of code
Case 2: ' lots of code
Case 3: ' lots of code
Case 4: ' lots of code
Case 5: ' lots of code
Case 6: ' lots of code
Case Else
' check all handcrafted listparagraphs
' and whether they may be related to each other
' and if, how they are related
End Select
End If
Next
End Sub

I'm sorry.


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
H

Helmut Weber

....
there is something wrong in the logic of the code,
just in case...
If rTmp.ListParagraphs.Count = 1 Then
Select Case rTmp.ListFormat.ListType
Case 1: ' some code
Case 2: ' some code
Case 3: ' some code
Case 4: ' some code
Case 5: ' some code
Case 6: ' some code
End Select
Else
' check all other possible bullets and numbers
' and whether they may be related to each other
' and if, how they are related
End If


Helmut Weber
 

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