Getting Word to save a file in .mht format

H

Hollis_mvp

I have an Outlook form that picks a message from an Outlook folder, stuffs
the message's .body property into a new Word document, constructs a file name
from the message header, and then constructs a path\name.mht string that I
use as an argument in the save as command. wdFormatWebArchive is the format
that is specified for saving files in the .mht format. It evaluates to 9 for
use in VBScript. 8 and 10 are the other two html formats.

When I use the command as follows:

MyDoc.SaveAs strSaveName, 9

The save dialog pops up. If I use 8 or 10, with .mht as the type in
strSaveName, it saves automatically, but SharePoint then will not load it as
a .mht file, which is what I am ultimately trying to achieve.

If I add the follosing command before the SaveAs command,

appWord.DefaultWebOptions.SaveNewWebPagesAsWebArchives
MyDoc.SaveAs strSaveName, 9

it still pops up the SaveAs dialog box, and my script doesn't complete
properly.

How do I get Word to automatically save the file in .mht format and allow my
script to complete properly.

Thank you.
 
H

Hollis D. Paul

appWord.DefaultWebOptions.SaveNewWebPagesAsWebArchives
MyDoc.SaveAs strSaveName, 9
How do I get Word to automatically save the file in .mht format and allow my
script to complete properly.
I have changed things around in the script, and now the files are being saved,
using the value of 9, and the files were then successfully uploaded to a SPPS
doclib as .mht files. I suspect that the script was completing too fast and
destroying objects before they were finished as sources. Don't know for sure,
but that explanation is all I have to offer.

Hollis D. Paul [MVP - Outlook]
(e-mail address removed)
Mukilteo, WA USA
 
C

Cindy M -WordMVP-

Hi Hollis,

Thanks for the update on this.
I have changed things around in the script, and now the files are being saved,
using the value of 9, and the files were then successfully uploaded to a SPPS
doclib as .mht files. I suspect that the script was completing too fast and
destroying objects before they were finished as sources. Don't know for sure,
but that explanation is all I have to offer.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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