Applying bullet styles in Word 2007

S

Steve X

I have an existing Macro in Word 2002 which applies bullet styles to list
items.

In 2002, this allowed me to have the cursor anywhere in the list item and
trigger the macro by the hotkey and the appropriate bullet style would be
set. In 2007, this only works if I highlight the whole entry. This seems to
be caused by a change in the definition of wdListApplyToSelection.

2007 behaviour is logical, but not what I want.

Here is my code:
Private Sub SetBullet(ByVal plBulletType As Long)
With ListGalleries(wdBulletGallery).ListTemplates(1).ListLevels(1)
.NumberFormat = ChrW(plBulletType)
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleBullet
.NumberPosition = InchesToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0.25)
.TabPosition = InchesToPoints(0.25)
.ResetOnHigher = True
.StartAt = 1
With .Font
Select Case plBulletType
Case mBULLET_DOT
.Name = "Symbol"
Case Else
.Name = "Wingdings"
End Select
End With
.LinkedStyle = ""
End With
ListGalleries(wdBulletGallery).ListTemplates(1).Name = ""
Selection.Range.ListFormat.ApplyListTemplateWithLevel
ListTemplate:=ListGalleries( _
wdBulletGallery).ListTemplates(1), ContinuePreviousList:=False,
ApplyTo:= _
wdListApplyToSelection


End Sub

I call this by having a number of hoykeys set up, each of which calls a
routine like this:

Sub BulletSquare()
SetBullet mBULLET_BOX
End Sub

.... and have a number of constants set up for the various bullet types:

Const mBULLET_TICKBOX As Long = 61694
Const mBULLET_BOX As Long = 61553
Const mBULLET_DOT As Long = 61623
Const mBULLET_ARROW As Long = 61656
Const mBULLET_CROSSBOX As Long = 61693

does anyone know how I can either get this to work on the list item in which
the cursor is currently positioned, or alternately, get the selection to
widen from (in the list item) to (all item selected)?
 
P

Pesach Shelnitz

Hi Steve,

The following line selects the whole entry where the cursor resides.

Selection.Expand wdParagraph

However, in my opinion, the way to achieve what I think you are trying to do
is to create a separate paragraph style for each type of bullet in the bullet
list gallery and apply one of these styles to each list item as desired.
 

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