ASP call VB.dll to Create Excel object it's not happen 
Author Message
 ASP call VB.dll to Create Excel object it's not happen

Hello

Can Any Help me about my program ? I write a program in my computer , the
enviorment is NT4.0 Server , IIS 4.0 .
First I create Web Project include this asp file :


<%
 dim  ob

 set ob = server.CreateObject ("tryExcel.try")  'This is my VB Dll

 set ob = nothing

%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<P>&nbsp;</P>

</BODY>
</HTML>

then I create VB ActiveX Dll , to create two class module :
First "try"
Option Explicit
Dim ExcelObj As ExcelCs

Private Sub Class_Initialize()
    Set ExcelObj = New ExcelCs
    ExcelObj.AddShet ("test")
    ExcelObj.WriteToCell "test", 1, "A", 1
End Sub

Private Sub Class_Terminate()
    Set ExcelObj = Nothing
End Sub

second "ExcelCs"
Option Explicit

Dim ExcApp As Excel.Application
Dim ExcWB As Excel.Workbook
Dim ExcWS As Worksheet
Dim ExcWW As Window

Private Sub Class_Initialize()
    If Not UseExistExcel(ExcApp) Then
        Set ExcApp = CreateObject(ExcelClass)
        ExcApp.Visible = True
    End If
    ExcApp.WindowState = 1
End Sub
Private Function UseExistExcel(ExcApp As Excel.Application) As Boolean
    On Error GoTo ExcelNotExist:
    Set ExcApp = GetObject(, ExcelClass)
    ExcApp.Visible = True
    UseExistExcel = True
    Exit Function
ExcelNotExist:
    UseExistExcel = False
    Exit Function
End Function

Private Sub Class_Terminate()
    Set ExcWB = Nothing
    Set ExcWS = Nothing
    Set ExcWW = Nothing
    Set ExcApp = Nothing
End Sub

Public Function SheetCount() As Long
    On Error Resume Next
    SheetCount = ExcApp.Sheets.Count
End Function
Public Function SheetName(sNUM As Long) As String
    On Error Resume Next
    SheetName = ExcApp.Sheets(sNUM).Name
End Function
Public Function GetCell(SheetNumber As Long, Column As String, Row As Long)
As Variant
    On Error Resume Next
    GetCell = ExcApp.Sheets(SheetNumber).Range(Column & Row)
End Function

Public Sub WriteToCell(pValue As Variant, SheetNumber As Long, Column As
String, Row As Long)
    On Error Resume Next
    ExcApp.Sheets(SheetNumber).Range(Column & Row).Value = pValue
End Sub
Public Sub AddShet(sNAME As String)
    On Error Resume Next
    ExcApp.Sheets.Add Before:=ExcApp.Sheets(1)
    ExcApp.Sheets(1).Name = sNAME

End Sub

Third include Module "Declare"
Option Explicit

Public Const ExcelClass As String = "Excel.Application"

I compile this vb program to dll (tryExcel) , and then register the dll in
MTX , then now I run web project start at asp file , Run is ok but I can't
see anything about Excel to create insert a "test" string , the
Server.CreateObject seem to be operated but it's no use . Why
. But If I deploy the (tryExcel) to *.cab and include it in asp file by
object , then thing is OK . why ? Who can explain for me this question ?
thank's a lot .

Forgive my English , I am Tawainese .

Regards ,
Chen , Sheng Chi



Mon, 17 Jun 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. com object will not read registry when com object called from asp (vb works fine)

2. Response object not working in DLL called thru ASP

3. VB DLL in ASP pages (OBJECT DOES NOT SUPPORT AUTOMATION)

4. VB DLL in ASP pages (OBJECT DOES NOT SUPPORT AUTOMATION)

5. VB DLL in ASP pages (OBJECT DOES NOT SUPPORT AUTOMATION)

6. Can't add class to ASP.NET project - Automation server can't create object

7. ASP Page's DLL's Use Count Not Going To Zero (or similar problem)

8. Call VB DLL or COM object from within VB COM object or EXE

9. printing from asp using excel (what is happening)

10. Calling ATL object in ASP not working

11. AxtiveX DLL to grab HTML not working when called from ASP

12. ActiveX Component Can't Create Object Exception in ASP.Net

 

 
Powered by phpBB® Forum Software