Question : excel vba to save worksheet as mht file

i'm trying to write a macro to save a xls worksheet as a "single file web page" with the "mht" file extension. I had a working macro to save it as an xls and I'm trying to modify it for "mht".

The attached code does save a file with the "mht" extension but it is in fact a xls file. I've tried to replace "FileFormat:=xlNormal" with "FileFormat:=xlHtmlStatic" but it creates an error.

Thanks.
1:
2:
3:
4:
5:
6:
7:
Private Sub Export_Button_Click()
Dim export_file_name
export_file_name = Application.GetSaveAsFilename(, "Single File Web Page (*.mht),*.mht")
Sheets("master").Copy
ActiveWorkbook.SaveAs Filename:=export_file_name, FileFormat:=xlNormal
ActiveWindow.Close
End Sub

Answer : excel vba to save worksheet as mht file

Try using:
FileFormat:=xlWebArchive
Random Solutions  
 
programming4us programming4us