Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2007

Tip: Looking for answers? Try searching our database.

Using vba Find/Replace Bullets

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andy Hammer - 27 Jun 2007 01:24 GMT
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
Klaus Linke - 27 Jun 2007 01:43 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.