Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to get Word macro to replace html bullet codes with bullets in Word?

Posted on 2010-08-18
4
Medium Priority
?
761 Views
Last Modified: 2012-06-22
Here is some text in my Word document. I need a macro to replace the html codes with Word bullets. This is part of a much longer document from a merge, so opening and converting is not an option. Thank you.
This is the start of this item. For example: <ul><li>The state may do this and that and blah blah blah text goes on and on for a few lines here asdlfkj asdl;kfj asdlfkj asd;lfk jasd;lfk jasdl;fk jasdfkl jasdfkl ajsdflk ajsdflk ajsdl;fk ajsd;fl ajsdfl;k ajsdl;fk ajsdlf ajsdfl; jsalf sdfj until the next bullet.</li><li>The schools will do this and that and that and this and on and on and on and on until the very next bullet point. </li><li>The next thing that happens is this and that and that and this and on and on asdlfj asldfj asldfjasl;dfj asl;dfkj as;ldfj asl;dfj asldf until the next point. </li><li>The next sentence is similar to the others about and goes on and on and on and on and this and that and that and this and so on and so forth and so on and so forth until the next bullet point.</li><li>This bullet point is comprised of three sentences that are all pretty long sentences, and this is sentence one. This bullet point is comprised of three sentences that are all pretty long sentences, and this is sentence two. This bullet point is comprised of three sentences that are all pretty long sentences, and this is sentence three. </li><li>Here is another one. </li><li>Just one more sentence here and on and on and on.</li></ul>
0
Comment
Question by:jswilkinsz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:PhilAI
ID: 33467067
Can you provide a small sample HTML file rather than just a section? I'm not sure I understand exactly what you want. Are you trying to convert an HTML file to a Word document?
0
 

Author Comment

by:jswilkinsz
ID: 33467505
The information comes from a spreadsheet, which is exported from a salesforce report. I have a merge in Word and then have some macros that deal with most of the codes, like <br> <p> etc.  The one problem I have is with the <li> codes and if there was a way to include something that searches for <li>, puts in the Word bullet, that is what I need. I could not find anything in replace under the special or formatting for bullet.
0
 

Accepted Solution

by:
jswilkinsz earned 0 total points
ID: 33468171
I got this macro to work.

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Style = ActiveDocument.Styles("List Bullet")
    With Selection.Find
        .Text = "<ul><li>"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Style = ActiveDocument.Styles("List Bullet")
        Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = "</li><li>"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
0
 
LVL 6

Expert Comment

by:PhilAI
ID: 33470217
Damn! I was just looking into that when I had to go out. Glad you figured it out for yourself - always feels better when you do that!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

636 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