VBA - Save Word Do as HTML (1 Viewer)

abbaddon223

Registered User.
Local time
Today, 00:43
Joined
Mar 13, 2010
Messages
162
Hello all,

I'm hoping someone can help me with what I thought was going to be a simple idea (sigh)

I'm using the below to merge an access form into a word template (it's a starter for 10).

That works fine. What I need to do is save the word template as HTML so I can then upload it to my website.

Can anyone kindly help please?


Dim wordApp1 As Word.Application
Dim docPath1 As String
Dim fileName1 As String
Dim PageName As String
PageName = Forms!Frm_Page_Create![Page]
docPath1 = Application.CurrentProject.Path & "\Merges"
fileName1 = docPath1 & "\Created\" & PageName & ".html"
Set wordApp1 = New Word.Application
With wordApp1


.Documents.Add docPath1 & "\Template\Page.Dotx" ' Where master template is with bookmarks
.Visible = True
.ActiveDocument.bookmarks.Item("Title").Range.Text = [Title]


.ActiveDocument.Activate
.ActiveDocument.Application.windowState = wdWindowStateNorma
.ActiveDocument.ActiveWindow.windowState = wdWindowStateNormal
.ActiveDocument.SaveAs2 (fileName1)



End With

'Print it or save it or some such thing?

wordApp1.ActiveDocument.Close
wordApp1.Quit
 

ByteMyzer

AWF VIP
Local time
Today, 00:43
Joined
May 3, 2004
Messages
1,409
You can try:
Code:
.ActiveDocument.SaveAs fileName1, wdFormatHTML
 

Users who are viewing this thread

Top Bottom