i have this code for convert xlsm to html . i need repeat this code for entireworkbook and
1-export filename , same as sheet name and in file path
2-select printarea range for convert each sheet
3-every sheet,seperate convert to html
Sub Export()
Dim rng As Range
file1 = ThisWorkbook.Path & "\" & "test.html"
Set rng = Sheets("Tabelle1").Range("A1:C10")
ActiveWorkbook.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=file1, _
Sheet:=rng.Worksheet.Name, _
Source:=rng.Address, _
HtmlType:=xlHtmlStatic).Publish
End Sub
Please, try the next way:
Sub ExportAllSheets()
Dim rng As Range, file1 As String, sh As Worksheet
For Each sh In ThisWorkbook.Sheets
If sh.PageSetup.PrintArea <> "" Then
Set rng = sh.Range(sh.PageSetup.PrintArea)
file1 = ThisWorkbook.path & "\" & sh.Name & ".html"
ActiveWorkbook.PublishObjects.Add( _
SourceType:=xlSourceRange, fileName:=file1, _
sheet:=sh.Name, Source:=rng.Address, _
HtmlType:=xlHtmlStatic).Publish
End If
Next
End Sub
It should export html files for each sheet, with sheet name as file name.