?
Solved

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

Posted on 2010-08-18
4
Medium Priority
?
728 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
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…

770 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