This spreadsheet contains the VBA code to write an Excel range as a clean, formatted HTML page, with optional auto-refresh.
NOTE If you click on the ‘This spreadsheet’ link above and it opens a ZIP file or a set of HTML files, right-click on the link and choose Save As.
- Correctly renders all Excel formatting, including conditional formats.
- Renders embedded charts.
- Generates an HTML page with tabs identical to those in the Excel file.
- Creates clean, formatted HTML that validates to HTML 4.01 strict.
- Optimised stylesheet to ensure minimal page weight.
- Supports merged cells with ROWSPAN and COLSPAN.
- Updates the webpage automatically when cells’ values are changed.
- The webpage automatically refreshes itself at a user-supplied interval.
14 March 2013. Update, improved lower tab bar to stop over-spilling (thanks to Paul Palmer) and added support for 64-bit Office.
21 August 2014. Many people have asked how to insert an image in the HTML page. It is not possible to get the contents of an embedded Excel image, but it is possible to get an embedded chart. Here’s how to perform this trick:
- In the sheet to be published, make sure no cells are selected
- Excel Menu->Insert->Chart and choose any chart type. This will insert an empty chart.
- Move and size the empty chart as required
- Select the chart by clicking its border
- Excel Menu->Layout and click the Picture icon
- Select an image file (JPG, BMP, etc) and Insert
28 September 2014. Now handles Unicode text correctly.
17 December 2018. Now outputs hyperlinks correctly.