Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting HTML text out of Microsoft Word Document

Status
Not open for further replies.

ninja800

Programmer
Joined
Jul 22, 2003
Messages
8
Location
US
Hi,

I have a microsoft word template and it has couple of
bookmarks. These bookmarks will be filled with values from
database. After these bookmarks have been filled I need to
get HTML text of this document and send it to MQ. Is there
any way I can extract HTML text from this document?

Thanks in advance,
 
Just do a Save As:

ActiveDocument.SaveAs FileName:="test.htm", FileFormat:=wdFormatHTML, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Thanks for your reply. I just want to make sure if I do it this way I won't get some junk code. Like I tried saving my existing doc to html and when I opened this file it look something like this

<html xmlns:o=&quot;urn:schemas-microsoft-com:office:office&quot;
xmlns:w=&quot;urn:schemas-microsoft-com:office:word&quot;
xmlns=&quot;
<head>
<meta http-equiv=Content-Type content=&quot;text/html; charset=windows-1252&quot;>
<meta name=ProgId content=Word.Document>
<meta name=Generator content=&quot;Microsoft Word 9&quot;>
<meta name=Originator content=&quot;Microsoft Word 9&quot;>
<link rel=File-List href=&quot;./NameAnil_files/filelist.xml&quot;>
<title>Name</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>adhingra</o:Author>
<o:LastAuthor>adhingra</o:LastAuthor>
<o:Revision>1</o:Revision>
<o:TotalTime>1</o:TotalTime>
<o:Created>2003-07-22T19:08:00Z</o:Created>
<o:LastSaved>2003-07-22T19:09:00Z</o:LastSaved>
<o:Pages>1</o:Pages>
<o:Company>Merrill Lynch</o:Company>
<o:Lines>1</o:Lines>
<o:Paragraphs>1</o:Paragraphs>
<o:Version>9.3821</o:Version>
</o:DocumentProperties>
</xml><![endif]-->
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:&quot;&quot;;
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:&quot;Times New Roman&quot;;
mso-fareast-font-family:&quot;Times New Roman&quot;;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
</head>

<body lang=EN-US style='tab-interval:.5in'>

<div class=Section1>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>Name<span style='mso-tab-count:2'>               </span><span
style='mso-tab-count:1'>            </span><b><span style='color:maroon'>Anil</span></b></p>

<p class=MsoNormal>Profession<span style='mso-tab-count:1'>        </span><span
style='mso-tab-count:1'>            </span><span style='color:maroon'>Programmer</span></p>

<p class=MsoNormal><b><span style='color:blue'>Country<span style='mso-tab-count:
1'>           </span><span style='mso-tab-count:1'>            </span>USA<o:p></o:p></span></b></p>

</div>

</body>

</html>

I just want simple html
 
Hi,

I have a microsoft word template that has couple of
{DOCVARIABLE}. I need to get the collection of all the
variables but when I try to use &quot;For Each aVar In
ActiveDocument.Variables&quot; it doesn't even go inside the
loop. I need to use select case statement to loop
through list of docvariables but I don't know how to do
it. Any help is appreciated.

Thanks in advance,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top