Forum Discussion
1 Reply
Sort By
- HKosovaSmartBear Alumni (Retired)Hi,
Excel has a built-in HTML table import feature, when you can paste the <table>...</table> HTML text into a worksheet, and Excel will automatically transform it into the corresponding table.
To automate this process, you could use a script like this:Sub ExcelTableImport
Dim strTableFruits, oExcel
' Copy the HTML source code of the table to the clipboard
Browsers.Item(btIexplorer).Run "http://www.w3schools.com/html/html_tables.asp"
strTableFruits = Sys.Browser.Page("http://www.w3schools.com/html/html_tables.asp").Panel(0).Panel(0).Panel(2).Panel(0).Panel(1).Table(0).outerHTML
Sys.Clipboard = strTableFruits
' Create an Excel workbook, paste the HTML table into it and save the file
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
oExcel.Workbooks.Add
oExcel.ActiveSheet.Paste
oExcel.ActiveWorkbook.SaveAs "E:\HTMLTable.xlsx"
oExcel.Quit
End Sub
Related Content
- 8 months agoLuukdb
- 2 years agoloricotton
- 2 months agoAdam2696
Recent Discussions
- 17 hours agojstaehlin
- 2 days agoAivanitskiy