Export to Excel not working with Office 2007

N

Neeraj

Hi,

The following client side vbScript Code to Export to Excel works fine with
Office 2003, but is not working when client machine has upgraded to Office
2007. Any clue ?

<script language="vbscript">
Sub exportbutton_onclick
Dim sHTML, oExcel, oBook
sHTML = document.all.item("DataGrid1").outerhtml
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML ‘’’’’’’’’
Getting Error at this line
oBook.HTMLProject.RefreshDocument
oExcel.Visible = true
oExcel.UserControl = true
End Sub

</script>

Error that I am getting is :::: “This method or property is no longer
supported in this version of Excel.â€

I am looking forward to generic solution which work fine with both office
2003 and 2007.

Any Suggestion is welcome?
 
S

Steve Rindsberg

The Script editor is no longer a part of the default Office 2007 install. It's an optional
item, one you have to do a custom install to get. Without it, there'd be no HTMLProject.

You might be able to solve the problem by re-running setup and choosing to install it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top