SFile = ActiveWorkbook.Path & '\test.htm' htm file in the same directory as your active workbook. Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples Sub CreateHTML() The HTML file is stored in the same working folder as the active workbook. The worksheet should have data in columns A, B, and C that correspond to the first, second, and third levels of the table of contents hierarchy.
This code example shows how to take data from a worksheet and create a table of contents in an HTML file.