Reputation:
I have a multiple sheet Excel workbook. I want to save one sheet as a html file using VBA.
It should be like the save as operation. When doing a manual save as the formatting is displaying in the saved HTML file. When using VBA the formatting is lost.
Application.Sheets("MNM Report").Activate
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:="D:\Reports\09192014\mnm.html"
How to do this functionality with out losing the formatting?
Upvotes: 2
Views: 16808
Reputation: 431
Try using the FileFormat
argument of the Workbook.SaveAs
Method. E.g.
ActiveWorkbook.SaveAs Filename:="D:\Reports\09192014\mnm.html" FileFormat:=xlHtml
You can see more options for FileFormat
in the XlFileFormat Enumeration from MSDN.
Upvotes: 3