Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using OWC for exporting data to Excel from a web page

Status
Not open for further replies.

kpobar

Programmer
Jul 10, 2007
10
US
Hello there---

I am working with OWC11 and I have successfully pulled data from a database and loaded it into a worksheet. The exported Excel file displays the data on a worksheet called Sheet. I would like to alter the worksheet name so that it says BaseInformation, then add an additional worksheet, but the code I have used is not making any changes to the exported file...

Dim xlsheet As New SpreadsheetClass
xlsheet.ActiveSheet.Name = "BaseInformation"

For Each dr As DataRow In ds.Tables(0).Rows

xlsheet.ActiveSheet.Cells(i, 1) = dr.Item("Name").ToString()
xlsheet.ActiveSheet.Cells(i, 2) = dr.Item("ProductNumber").ToString()

i = i + 1

Next

... this code successfully performs the For Each loop, but the xlsheet.ActiveSheet.Name line of code has no effect at all... any ideas as to why?

Thanks!

---kpobar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top