Bulleted lists conversion problems. Help!

H

Harry-Wishes

Hello,

I am trying to programatically extract the html source code from which a
Word document is based and store that code in another Word document. The
problem I am having is as follows. Ordered and unordered lists display the
correct html code in the Microsoft Script Editor window as shown below.

<ul style='margin-top:0in' type=disc>
<li class=MsoNormal style='mso-list:l2 level1 lfo4;tab-stops:list
..5in'>Dogs</li>
<li class=MsoNormal style='mso-list:l2 level1 lfo4;tab-stops:list
..5in'>Cats</li>
<li class=MsoNormal style='mso-list:l2 level1 lfo4;tab-stops:list
..5in'>Rats</li>
<li class=MsoNormal style='mso-list:l2 level1 lfo4;tab-stops:list
..5in'>Mice</li>
</ul>

However, when I run the subroutine (see below), that html code converts the
original code by stripping all of the <ul> and <li> tags, replacing them with
<p> tags as shown below. Why is Microsoft doing this? Any ideas? That's all I
really need to know.

Thanks
Harry Wishes.

'SNIPPET OF MY SUBROUTINE

html_string = ActiveDocument.HTMLProject.HTMLProjectItems("filename.htm").Text

With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="htmlcode"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With

Dim html_code As Range
Set html_code = ActiveDocument.Bookmarks("htmlcode").Range
html_code.Text = html_string


RESULTS:
<p class=MsoNormal>Dogs</p>
<p class=MsoNormal>Cats</p>
<p class=MsoNormal>Rats</p>
<p class=MsoNormal>Mice</p>
 

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