Question posted 2012 · +11 upvotes
I know that excel is capable of opening html files directly. But the content of the file will still be html. Is there any way I can change the contents of the file from html to xls or xlsx?
Accepted answer +11 upvotes
So long as Excel can open the file, the functionality to change the format of the opened file is built in.
To convert an .html file, open it using Excel (File – Open) and then save it as a .xlsx file from Excel (File – Save as).
To do it using VBA, the code would look like this:
Sub Open_HTML_Save_XLSX()
Workbooks.Open Filename:="C:TempExample.html"
ActiveWorkbook.SaveAs Filename:= _
"C:TempExample.xlsx", FileFormat:= _
xlOpenXMLWorkbook
End Sub
Top excel Q&A (6)
- Shortcut to Apply a Formula to an Entire Column in Excel +335 (2011)
- How should I escape commas and speech marks in CSV files so they work in Excel? +136 (2012)
- Convert xlsx to csv in linux command line +96 (2012)
- How to create a link inside a cell using EPPlus +50 (2011)
- IF statement: how to leave cell blank if condition is false ("" does not work) +44 (2013)
- T-SQL: Export to new Excel file +44 (2012)
excel solutions on this site
.