Using vba Find/Replace Bullets

A

Andy Hammer

Hi All

I am using Word 2000, hope someone can assist, I know alot about Excel
vba but am

To maintain the formatting of a document, I am requiring the users to
paste sometimes large amounts of text into a userform that pastes it
as unformatted text into the relevant bookmark in the doument. One
problem I have is that where a portion of the text was bullet points
it becomes ·(followed by a tab).

Using Selection.Find.Text = "·" & vbTab allows me to find the
unformatted bullet point.

After pasting of the information I need to:
Start from the top of the doc
Find the first unformatted bullet
Apply bullet formatting
Delete the "·" & vbTab
Find next unformatted bullet and repeat til all are formatted bullet
points

Using vba I managed to find the unformatted bullet and change to a
formatted bullet point but could not get it to move on to the next one
etc. I guess I am having trouble applying this into some sort of loop.

Hope this makes sense, any help would be appreciated.

Regards

Andy
 
K

Klaus Linke

Hi Andy,

I think you should be able to remove the existing bullet and apply a
bulleted style all in one wildcard replacement.

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style =
ActiveDocument.Styles(wdStyleListBullet)
With Selection.Find
.Text = "·^9(?)"
.Replacement.Text = "\1"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

Regards,
Klaus



Hi All

I am using Word 2000, hope someone can assist, I know alot about Excel
vba but am

To maintain the formatting of a document, I am requiring the users to
paste sometimes large amounts of text into a userform that pastes it
as unformatted text into the relevant bookmark in the doument. One
problem I have is that where a portion of the text was bullet points
it becomes ·(followed by a tab).

Using Selection.Find.Text = "·" & vbTab allows me to find the
unformatted bullet point.

After pasting of the information I need to:
Start from the top of the doc
Find the first unformatted bullet
Apply bullet formatting
Delete the "·" & vbTab
Find next unformatted bullet and repeat til all are formatted bullet
points

Using vba I managed to find the unformatted bullet and change to a
formatted bullet point but could not get it to move on to the next one
etc. I guess I am having trouble applying this into some sort of loop.

Hope this makes sense, any help would be appreciated.

Regards

Andy
 

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