| Simple MakeHTML | Saving XML files |

A macro to make an HTML page from an Excel worksheet (advanced)

A visual basic macro

Excel contains a command to save an area of a worksheet in HTML format so that it can viewed through a web browser and incorporated in a website. The files created by this command are generally a faithful representation of the original worksheet but this may be achieved by generating a series of files and folders.

Alternatively a macro can be used to create a web page which contains plenty of formatting and can be user defined to convert a particular range of a worksheet. If the page is to be regularly updated and published the macro can be linked to a button placed on your worksheet.

convert a worksheet to an html file using an Excel macro

A spreadsheet such as this can be converted into HTML code (a web page) and inherit the following features:

Create web page tables with expanding or drill down sections

excel web page

Find out more

To view the converted page, click here.

A simpler version of the macro is available for data which is to be converted into a plain table. This will make a more compact file.

The macro is intended to be incorporated within a spreadsheet which is occasionally converted and published. Instead of presenting the user with a series of dialog boxes into which they can enter the settings each time the macro is run, these settings are declared as variables within the code of the macro itself. Therefore, although only a very limited knowledge of VBA is required, this solution is not appropriate to all users.

The macro is saved as a text file and can be opened here.

Setting up the macro

Open the Excel spreadsheet that you wish to publish. Open the VBA editor and paste the code into a new module. The MakeHTM procedure should then be visible in your list of macros.

Select and edit the procedure.

Would you like to learn more?


Excel 2010 Power programming with VBA

Return to your worksheet and run the MakeHTM macro.

Notes about the conversion

The output HTML file may not be a faithful reproduction of your original. Some of the defects can be resolved by amending your spreadsheet.

The macro was written by Chris Mead.

Get this information as a document
accompanied by Excel worksheets
The document is in PDF format Click here for details about
obtaining this file

learn html W3Schools provides a collection of free HTML, CSS, JavaScript, DHTML, XML, XHTML, WAP, ASP, SQL tutorials with lots of working examples and source code. I have found this to be the most useful site for learning about anything web-related.

file: xladvhtml.htm 2014 Last updated Feb14