Need help on a vbscript to convert .xlsx to .html file

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I am writing a vbscript to convert an excel file (.xlsx) to webpage format (.html). Below is script that I use to test with. The script convert the file fine. However, the workbooks style did not get export (background color, border, etc.). Any advises on this issue are greatly appreciated.
Thanks,
colsoh
######################################Dim objExcel, objWorkbook
Dim strFileToBeConvert, strFileConverted
Const xlHtml = 44

strFileToBeConvert = Wscript.Arguments(0)
strConvertedFile = Wscript.Arguments(1)

Creat excel application object
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(strFileToBeConvert)

objExcel.Visible = False
objExcel.DisplayAlerts = False
objWorkbook.SaveAs strConvertedFile, xlHtml, true

Clean up
objWorkbook.Close
objExcel.Quit
WScript.Quit
############################################

View the full article
 
Back
Top