Generating an excel file with webclass not working Please Help 
Author Message
 Generating an excel file with webclass not working Please Help

Hi,

I am using the code below to generate an excel file from a webserver, the
code works fine in the VB 6.0 Development environment but when i deploy the
.dll file to the server and register it i receive an error, If someone could
help me out beacuse i would not have a clue.

Thanks in advance

Sean

------------------------------------------------------ Error Msg

Project1 error '800a9c68'

Application-defined or object-defined error

/admin/report/report.asp, line 13

----------------------------------------------------------Source Code

Option Explicit
Option Compare Text

Private currentdb As New ADODB.Connection
Private db As New ADODB.Connection
Private cn9 As New ADODB.Connection

Private rsSecretaries As New ADODB.Recordset

'---------- REMEMBER THE DATA TYPES FOR THE DATABASE NEED
{*filter*}  ----------

'---------- CONNECTION STRING TO OPEN DATABASE  ----------

'Public Sub connectme(objConnection As ADODB.Connection)
'   objConnection.Provider = "Microsoft.Jet.Oledb.4.0"
 '  objConnection.Open "D:\InetPub\WWWRoot\arizona\database\arizona.mdb",
"", ""
'End Sub

Public Sub connectme(objConnection As ADODB.Connection)

  objConnection.Provider = "Microsoft.Jet.Oledb.4.0"
  objConnection.Open "D:\Datasources\arizona.mdb", "", ""
End Sub

Public Sub sTestXL()
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Dim nMaxCol As Integer
Dim nMaxRow As Integer

If cn9.State = adStateClosed Then
    connectme cn9
End If

With rsSecretaries
    .Open "SELECT secretaries.FirstName, secretaries.EmailAddress From
secretaries ORDER BY secretaries.FirstName", cn9, adOpenStatic
    If Not (.BOF And .EOF) Then
    nMaxCol = .Fields.Count
    .MoveLast
    .MoveFirst
    nMaxRow = .RecordCount

    Set xlApp = New Excel.Application
    Set xlWB = xlApp.Workbooks.Add
    xlWB.Sheets(1).Range("A1").Resize(nMaxRow, nMaxCol).CopyFromRecordset
rsSecretaries

    xlWB.Close Savechanges:=True
    Set xlWB = Nothing
    xlApp.Quit
    Set xlApp = Nothing

End If
End With

End Sub

Private Sub reportindex_Respond()
Call sTestXL
reportindex.WriteTemplate
End Sub

Private Sub WebClass_Start()
 Set NextItem = reportindex
End Sub



Mon, 30 Dec 2002 03:00:00 GMT  
 Generating an excel file with webclass not working Please Help
Hi,

The error you get is a generic one that basically indicates that any
unhandled error has occurred (eg The database could not be opened,
Excel is not installed on the server etc.) Your first step, therefore,
should be to include some error handling code to help you pinpoint the
problem.

Regards,

    /Olof

Quote:
> Hi,

> I am using the code below to generate an excel file from a webserver,
the
> code works fine in the VB 6.0 Development environment but when i
deploy the
> .dll file to the server and register it i receive an error, If
someone could
> help me out beacuse i would not have a clue.

> Thanks in advance

> Sean

> ------------------------------------------------------ Error Msg

> Project1 error '800a9c68'

> Application-defined or object-defined error

> /admin/report/report.asp, line 13

> ----------------------------------------------------------Source Code

> Option Explicit
> Option Compare Text

> Private currentdb As New ADODB.Connection
> Private db As New ADODB.Connection
> Private cn9 As New ADODB.Connection

> Private rsSecretaries As New ADODB.Recordset

> '---------- REMEMBER THE DATA TYPES FOR THE DATABASE NEED
>{*filter*}  ----------

> '---------- CONNECTION STRING TO OPEN DATABASE  ----------

> 'Public Sub connectme(objConnection As ADODB.Connection)
> '   objConnection.Provider = "Microsoft.Jet.Oledb.4.0"
>  '

objConnection.Open "D:\InetPub\WWWRoot\arizona\database\arizona.mdb",

- Show quoted text -

Quote:
> "", ""
> 'End Sub

> Public Sub connectme(objConnection As ADODB.Connection)

>   objConnection.Provider = "Microsoft.Jet.Oledb.4.0"
>   objConnection.Open "D:\Datasources\arizona.mdb", "", ""
> End Sub

> Public Sub sTestXL()
> Dim xlApp As Excel.Application
> Dim xlWB As Excel.Workbook
> Dim nMaxCol As Integer
> Dim nMaxRow As Integer

> If cn9.State = adStateClosed Then
>     connectme cn9
> End If

> With rsSecretaries
>     .Open "SELECT secretaries.FirstName, secretaries.EmailAddress From
> secretaries ORDER BY secretaries.FirstName", cn9, adOpenStatic
>     If Not (.BOF And .EOF) Then
>     nMaxCol = .Fields.Count
>     .MoveLast
>     .MoveFirst
>     nMaxRow = .RecordCount

>     Set xlApp = New Excel.Application
>     Set xlWB = xlApp.Workbooks.Add
>     xlWB.Sheets(1).Range("A1").Resize(nMaxRow,

nMaxCol).CopyFromRecordset

- Show quoted text -

Quote:
> rsSecretaries

>     xlWB.Close Savechanges:=True
>     Set xlWB = Nothing
>     xlApp.Quit
>     Set xlApp = Nothing

> End If
> End With

> End Sub

> Private Sub reportindex_Respond()
> Call sTestXL
> reportindex.WriteTemplate
> End Sub

> Private Sub WebClass_Start()
>  Set NextItem = reportindex
> End Sub

Sent via Deja.com http://www.*-*-*.com/
Before you buy.


Tue, 31 Dec 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Excel file cannot be generated from the server using webclasses - Please Help

2. If the Ftp_Server have no file.......the program will hold and not working ....please help me~

3. If the Ftp_Server have no file.......the program will hold and not working ......please help me~

4. WebClass not working when compiled

5. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

6. HELP: VB 6 works with Access97 file, not Access 2000 file

7. PLEASE, PLEASE HELP, am I going MAD - Generating Totals

8. Help Please...Code does not work why?

9. Help!!! Please - Windows ME item.forward not working

10. Attachments.Add Item,5 does not work please help

11. Server.CreateObject not working -- Please help!!

12. Shell command not working...Please help

 

 
Powered by phpBB® Forum Software