' exports the selected range as an html table (does not produce full html just the html table part) Sub export_table_as_html() Dim Printstring As String Dim r As Long Dim c As Long Dim WebpageName As Variant Dim WebpageFile As String WebpageName = Application.GetSaveAsFilename( _ fileFilter:="Web pages (*.html), *.html, All Files (*.*), *.*") If WebpageName = False Then Exit Sub WebpageFile = WebpageName Open CStr(WebpageFile) For Output As #1 Print #1, "" For r = Selection(1).Row To _ Selection(1).Row + Selection.Rows.Count - 1 Print #1, "" For c = Selection(1).Column To _ Selection(1).Column + Selection.Columns.Count - 1 Print #1, "" Next Print #1, "" Next Print #1, "
" & Cells(r, c).Text & "
" Close #1 ActiveWorkbook.FollowHyperlink WebpageFile End Sub