HtmlToRTF




Sub ConvertWordDoc()
Static WordObj As Word.Application
Set WordObj = CreateObject("Word.Application")
WordObj.Documents.Open ("c:\my documents\test.htm")
'Disable viewing the Word session

'and its document

WordObj.Visible = False
WordObj.ActiveDocument.SaveAs "c:\my documents\test.rtf", wdFormatRTF
WordObj.Quit savechanges:=False
Set WordObj = Nothing
End Sub

Assumes:
Just copy and paste to your module.
Dont forget to set the reference for MSWord Object Library.

Note the use of the Static keyword to prevent the object
variable from losing scope. Once the object variable loses
scope, the instance of Microsoft Word is destroyed.











( htmltortf.html )- by Paolo Puglisi - Modifica del 17/12/2023