Convert table to html tags without using saveas option in word vba
Convert table to html tags without using saveas option in word vba
What have you tried that does use saveas option in Word vba?
You posted a similar question at https://social.msdn.microsoft.com/Fo...a?forum=isvvba where I showed how to save a table to HTML format. If you want to save each table as HTML then that is a simple modification
What is not so simple (or understood, as Word is not an HTML editor) is what you are trying to do with the html code relating to the table in the document?Sub CopyTablesToHTM() Dim oSource As Document Dim oDoc As Document Dim oTable As Table Dim i As Long Dim oRng As Range Dim strName As String Set oSource = ActiveDocument On Error Resume Next oSource.Save If Len(oSource.Path) = 0 Then MsgBox "Save the document first!" Exit Sub End If If oSource.Tables.Count = 0 Then MsgBox "There are no tables in the document" Exit Sub End If For i = 1 To oSource.Tables.Count Set oTable = oSource.Tables(i) oTable.Range.Copy Set oDoc = Documents.Add(Template:=oSource.FullName) Set oRng = oDoc.Range oRng.Paste strName = Left(oSource.Name, _ InStrRev(oSource.Name, Chr(46)) - 1) & "(" & i & ").htm" strName = oSource.Path & Chr(92) & strName oDoc.SaveAs FileName:=strName, _ FileFormat:=wdFormatFilteredHTML oDoc.Close 0 Next i End Sub
Please do not post to multiple forums without cross posting, to avoid a duplication of effort by those of us who provide our time to answer such questions.
Graham Mayor - MS MVP (Word) 2002-2019
Visit my web site for more programming tips and ready made processes
http://www.gmayor.com