VBA HTML Conversion Code for Excel


Excel to HTML Conversions

The macros below convert an Excel range to a HTML Table. Most formating, including merged cells, bold, italic and many colors are preserved. Font size, row & column hight are ignored. I may add those at a later date. The main advantages to my macros over the SAVE AS HTML option built into recent versions of Excel are speed of conversion, preservation of your current file definition after the save, and smaller HTML documents. The amount of formatting preserved is about the same.

This code is Care Ware! You may use it and adapt it for free in return for doing something nice for anyone (that includes you). I'd appreciate Email at charlie@balch.org describing how you use this code and any adjustments that you have made. Redistribute at will. Please leave my name in the original source comments.

Macros

  • Excel 5 .
  • Excel 97.
  • Excel 2000 - Sample Spreadsheat (Note: To download the SS, right click on the "Sample Spreadsheat" link, then choose Save Target As).

    Here is a macro that calls the above macros, then FTPs the results. This macro uses WS_FTP.

    Examples

  • On-line gradesheet updated with a single click.
  • My Current PC configuration - I cheated on this one by putting the IMG tag on the Excel worksheet.


    HTML to Excel Conversions

    This couldn't be easier.
    Do the complete custom install of Excel 97 or 2000 and you will be able to copy and paste or load an HTML file into Excel on the fly.
    Even cooler you might want to explore "Web Query" under the "get external data" option under the data menu in Excel 2000 (it might be in 97 too). One of the options allows you to create a memorized routine that will visit your favorite web page and extract the current data from a table on the fly. Web Queries can be controlled with VBA, memorize UserID/passwords and such!
    In example, I wrote some courseware (freeware at YACS) that automatically tracks students' progress as they answer on-line questions. This information is part of their overall grades. To update my grade sheet, I simply hit a button on my toolbar that runs a custom macro against an ASP file that creates the appropriate table. Microsoft included some very cool examples as well.


    More Resources

    Here is my CIS Course Information Page.
    Here is my Business Reference Page.
    Here is my Home Page.

    Thanks for visiting!
    http://charlie.balch.org at charlie@balch.org.