View Full Version : Saving document as html or mht in VBA
mark_h82
05-14-2007, 06:59 AM
Hi, Can anyone help with code to save a document as a html or a mht file?
If I simply use Application.ActiveDocument.SaveAs ("H:\....\\" & ".mht" or .html")
Although this looks fine in the folder directory, it obviously doesn't save correctly.
shasur
05-14-2007, 07:24 AM
A crude method
Application.DisplayAlerts = wdAlertsNone
sMyName = Left(ActiveDocument.FullName, Len(ActiveDocument.FullName) - 4)
ActiveDocument.SaveAs FileName:=sMyName & ".mht", FileFormat:=wdFormatWebArchive
ActiveDocument.Close
' Use this if need to save as HTM. But it will save images as separate files that you need to move along with HTM document
ActiveDocument.SaveAs FileName:=sMyName & ".htm", FileFormat:=wdFormatHTML
Application.DisplayAlerts = wdAlertsAll
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.