?
Solved

How to find bullets with VBA

Posted on 2000-01-18
3
Medium Priority
?
708 Views
Last Modified: 2008-03-10
I'm working on a macro in which I want to find all paragraphs with bullets. There are different kinds of bullets in the document, the user has used different list templates. The document in questions has bullets in 5 different levels, so I can't specify a certain indent.

Is there a way to find all bullets? I need to do this because the margin in the template upon which the document is based, has been changed. Although everything else (margins, headers etc) is being updated according to the new template, the paragraphs with bullets remain on the same place. I need to locate every bullet and change the left indent for each of those paragraphs. Unfortunately, I can't use the find and replace method, because it's impossible to search for bullets. Any suggestions, anyone?
0
Comment
Question by:anvaldem
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
ture earned 600 total points
ID: 2363522
anvaldem,

This should be what you are looking for...

Sub FindBullets()
  Dim p As Paragraph
  For Each p In ActiveDocument.Paragraphs
    If p.Range.ListFormat.ListType = wdListBullet Then
      p.Range.Select
      MsgBox "Found a bullet!"
    End If
  Next p
End Sub

Ture Magnusson
Karlstad, Sweden
0
 

Author Comment

by:anvaldem
ID: 2366298
Great! You saved me many hours! Thankyou.

// Anette, Orebro, Sweden
0
 
LVL 22

Expert Comment

by:ture
ID: 2366895
Anette,

Thanks for the points. I'm glad that I could help you!

It's nice to meet a neighbour here... I see that you work with Office/VBA consulting. Are you self-employed or do you work for another company? Do you have too much to do? Perhaps we could cooperate and help each other?

Ture Magnusson

Turedata AB
Alfens vag 37
653 45  Karlstad
054-568815
070-626 09 11
ture_magnusson@hotmail.com
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question