Saving doc as MHTML

D

David Every

Hi , I am generating a Word 2003 document using VBScript
similar to the following:

' Create an instance of Word
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
' Add a new document
Set wrdDoc = wrdApp.Documents.Add
wrdDoc.PageSetup.Orientation = wdOrientPortrait
wrdDoc.Select
Set wrdSelection = wrdApp.Selection
wrdDoc.Select
' Create a string and insert it into the document
StrToAdd = "Release Note"
wrdSelection.Font.Name
= "Arial"
wrdSelection.Font.Size = 12
wrdSelection.Font.Bold = True

StrToAdd = "Build Information"
wrdSelection.ParagraphFormat.Alignment =
0 'wdAlignParagraphLeft
wrdSelection.TypeText StrToAdd


'now save it as MHTML
wrdDoc.SaveAs "C:\Temp\Dev\BuildReleaseNotes.mhtml",10

' I have also tried
wrdDoc.SaveAs "C:\Temp\Dev\BuildReleaseNotes.mhtml",8


But the resulting mhtml file is not in the correct MHTML
format, I would like to know how to emulate the Word ->
File -> Save As -> Web Archive (*.mht, *.mhtml) function
in VBScript.
Any help much appreciated.. thanks in advance
Regards
David E
 
L

Lars-Eric Gisslén

David,

Did you try
wrdDoc.SaveAs "C:\Temp\Dev\BuildReleaseNotes.mhtml",9

The constant wdFormatWebArchive is actually 9.
10 = wdFormatFilteredHTML and 8 = wdFormatHTML

Regards,
Lars-Eric
 

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