function goExportExcel() ON ERROR RESUME NEXT if Isobject(document.getElementById("divrpt")) = false then EXIT FUNCTION DIM sHTML, oExcel, fso, filePath sHTML = document.all.item("divrpt").outerhtml sHTML = replaceMe(sHTML) alert(sHTML) StripHTMLwithnoclass = Replace(Replace(Replace(sHTML,"class=bordergrey","style='background-color: #CCCCCC;'"),"class=commontablebg","style='background-color:#FBF8F8;'"),"class=clsborder","style='BORDER-RIGHT: #F5F5F5 1px solid;BORDER-TOP: #F5F5F5 1px solid;BORDER-LEFT: #F5F5F5 1px solid;BORDER-BOTTOM:#F5F5F5 1px solid;'") SET fso = CreateObject("Scripting.FileSystemObject") filePath = fso.GetSpecialFolder(2) & "\tmpdata.xls" fso.CreateTextFile(filePath).Write(sHTML) err.Clear() SET oExcel = CreateObject("Excel.Application") IF err.number>0 OR oExcel =NULL THEN msgbox("You need to have Excel Installed and Active-X Components Enabled on your System.") EXIT FUNCTION END IF oExcel.Workbooks.open(filePath) oExcel.Workbooks(1).WorkSheets(1).Name = "D-Mat Data" oExcel.Visible = true Set fso = Nothing End function