+ Start a Discussion
arasuarasu 

Export to excel not working on some machines with the same IE 6.0.2900 version

Hi,

We have a custom print button that uses activeX for exporting a custom S-control report to excel. But when we click the export to excel button, it throws the following javascript error:

Invalid Procedure call or argument.

I have enabled all activeX setting under the internet options, but still it does not work on certain machines/laptops that has the same IE version. It works fine on my machine and some other similar machines that has the same IE version.

The VB script code that executes in the S-control when user clicks the custom "Export to Excel" button is this:

Code:
<script language="vbscript"> 

Sub expToExcel1

sHTML = document.all.item("exptmatrixdata").outerhtml

set Response.ContentType = "application/vnd.ms-excel"

Reponse.Write(sHTML)

End Sub


Sub expToExcel

Dim sHTML, oExcel, oBook 

sHTML = document.all.item("exptmatrixdata").outerhtml 

Set oExcel = CreateObject("Excel.Application") 

Set oBook = oExcel.Workbooks.Add 

oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML 

oBook.HTMLProject.RefreshDocument 

oExcel.Visible = true 

oExcel.UserControl = true

End Sub 

</script> 


 

Appreciate if anyone can give their feedback on this issue.

Thanks and regards,
Ambili