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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Automation

Status
Not open for further replies.

born2program

Technical User
Sep 18, 2006
85
US
I am trying to export data from a dataset in some vb script behind my asp page. When I run the code I get an error that says "Specified Cast Not Valid". This is the code I have so far. Didn't know whether to post this in the vb forum or the asp. Any help is appreciated. Thanks.

Private Sub btnExportXLS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExportXLS.Click
Dim oExcel As Excel.Application
Dim oBook As Excel.Workbook
Dim oSheet As Excel.Worksheet

Dim iRow As Integer
Dim iCol As Integer

Dim a As Integer
Dim Folder As String
Dim TopCellAddr As String
Dim ColumnLetter As String

Dim objDataHandler As New DataHandler
Dim objDeptDataSet As New DataSet
Dim objDeptDataView As New DataView

Dim dt As DataTable
Dim dr As DataRow

objDeptDataSet = objDataHandler.getChecksToBePrinted
objDeptDataView = objDeptDataSet.Tables.Item(0).DefaultView


oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
End Sub
 
I'm not clear on the goal.

The code above is where?
1. ASP server-side logic
2. Excel macro
3. Stand alone .VBS file
4. HTA file
5. Browser-side logic written in VBScript in an HTML or ASP
6. ASP.NET
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top