Web Development

General discussion


Word 2000 VBA - Bullets Selection

By meatyman ·
I have a very DUMB question which I just can't figure out simply because I am dumber than the question itself -_-#

Let's say I have a bullet list which consists of an unknown number of items. How can I highlight everything within the list?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Word 2000 VBA - Bullets Selection

by Irina Medvinskaya In reply to Word 2000 VBA - Bullets S ...

To make this work:
1. Create a new word document and add the following or similar information in it:

Title info

? Bullet1
? Bullet2
? Bullet33333333
? Bulletbulletbullet4

End of Information

2. Create a new style for the bulleted text and call it BulletInfo.
3. In your VBA code write the following:

Option Explicit

Sub Main()
Dim iStart As Integer, iEnd As Integer
Dim bStart As Boolean
Dim sRange As Range

'move to the top of document
Selection.HomeKey Unit:=wdStory, Extend:=wdMove

'start searching for "BulletsInfo" style
Selection.Find.Style = ActiveDocument.Styles("BulletsInfo")
With Selection.Find
.Text = ""
.Replacement.Text = "" .Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
bStart = True
'find the style
Do While Selection.Find.Execute(FindText:="", Forward:=True, Format:=True) = True
If bStart = True Then
'remember starting point
iStart = Selection.Range.Start
bStart = False
End If
Selection.MoveDown Unit:=wdParagraph, Count:=1
'remember ending point
iEnd = Selection.Range.End
'specify the range with beginning and ending points
Set sRange = ActiveDocument.Range(Start:=iStart, End:=iEnd)
'select the bullets
End Sub

4. If you don't know how to create a new style:
write some text in the document
make it bulleted
in the left top corner of the toolbar where all styles are listed type in BulletsInfo (when the bulleted line is highlighed).
you now have a style called BulletsInfo. To check this, type a word and select BulletsInfo from the Style dropdown, the text will have bullets.

Collapse -

Word 2000 VBA - Bullets Selection

by meatyman In reply to Word 2000 VBA - Bullets S ...

Poster rated this answer

Collapse -

Word 2000 VBA - Bullets Selection

by meatyman In reply to Word 2000 VBA - Bullets S ...

This question was closed by the author

Related Discussions

Related Forums