B
Bruno
Hi all,
I have a simple HTML table:
<table id="ResultTable">
<tr><td>TEST</td></tr>
</table>
Then I put a button to export to Excel
<INPUT TYPE="Button" value="Export2Excel" onclick="Export()">
The function:
<script language="vbscript">
Sub Export
Dim sHTML, oExcel, oBook
sHTML = document.all.item("ResultTable").outerhtml
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
oExcel.Visible = true
oExcel.UserControl = true
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
oBook.HTMLProject.RefreshDocument
Set oBook = nothing
Set oExcel = nothing
End Sub
</script>
This works OK in some computers but I get error "Invalid Procedure call or
Argument" on other computers.
It doesn´t work in several computers!!
The error points to
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
How can I solve this?
All the computers don't have add-ons in C:\Program Files\Microsoft
Office\OFFICE11\XLSTART
It's Excel 2003 SP3
Thank you very much
I have a simple HTML table:
<table id="ResultTable">
<tr><td>TEST</td></tr>
</table>
Then I put a button to export to Excel
<INPUT TYPE="Button" value="Export2Excel" onclick="Export()">
The function:
<script language="vbscript">
Sub Export
Dim sHTML, oExcel, oBook
sHTML = document.all.item("ResultTable").outerhtml
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
oExcel.Visible = true
oExcel.UserControl = true
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
oBook.HTMLProject.RefreshDocument
Set oBook = nothing
Set oExcel = nothing
End Sub
</script>
This works OK in some computers but I get error "Invalid Procedure call or
Argument" on other computers.
It doesn´t work in several computers!!
The error points to
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
How can I solve this?
All the computers don't have add-ons in C:\Program Files\Microsoft
Office\OFFICE11\XLSTART
It's Excel 2003 SP3
Thank you very much