Convert XLSX to HTML / MHT

During certain scenarios we want to automate file conversion for sending reports via email. If we need to send emails to external recipients; Macro enabled excel sheets might get blocked on the go.

To overcome such situations, I found a site to convert excel “XLSX” to “XLS”. I would like to thank to owner of the blog and courtesy to use the script.

But this may not help us since even XLS file extensions with Macros will be blocked by exchange. So I modified script to get HTM/MHT format which can easily be sent via emails without any hiccups.

VB Script is as below

Set objExcel = CreateObject(“Excel.Application”)
Set objWorkbook = objExcel.Workbooks.Open(Wscript.Arguments(0))
objExcel.Application.Visible = False
objExcel.Application.DisplayAlerts = False
objExcel.ActiveWorkbook.SaveAs Wscript.Arguments(1), 45
objExcel.Application.DisplayAlerts = True
‘ XLSX->XLS conversion script by Michael Kuzmin
‘ This is how you can you it:
‘ c:\xlsx2htm.vbs “C:\inputdocument.xlsx” “C:\outputdocument”
‘ file format numnber 57 is for pdf format
’44 is for html
’45 is for mht

‘end of script

Copy above script to notepad and save it as “cc:\xlsx2htm.vbs”

Open command prompt and type

c:\xlsx2htm.vbs “C:\inputdocument.xlsx” “C:\outputdocument

output file will be in “MHT” format.


2 thoughts on “Convert XLSX to HTML / MHT

  1. Hi, very interesting thema, congratulations!

    Could You please make contact? I need some aplications to solve batch conversions from xls to mht and, also, interesting math map project who can use Perl (neural AI)

    thanks in advance

    Professor Jorge


    skype clubedasloterias

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s