Crash attempting to open Excel Add-in using .dll file comprised of VB6 code
CM,
I don't follow all the description of your setup, how and what you are
doing. However I put the following together which seems to work -
VB6 dll / project named "gEventStuff"
'start code class named "gEventHandler"
Dim WithEvents oxl As Excel.Application
Dim sXLAPath As String
Public Property Set App(x As Excel.Application)
Set oxl = x
End Property
Public Property Let sFile(s As String)
sXLAPath = s
End Property
Sub OpenMyWB()
oxl.Workbooks.Open sXLAPath, 0
End Sub
' end code class named "gEventHandler"
' start code in a normal module of an Excel WB
Public vb6Test As gEventStuff.gEventHandler
Sub auto_open()
Set vb6Test = New gEventStuff.gEventHandler
Set vb6Test.App = Excel.Application
vb6Test.sFile = "C:\Temp\Test.xla"
vb6Test.OpenMyWB
'Set vb6Test = Nothing
End Sub
Sub auto_close()
Set vb6Test = Nothing
End Sub
With no open instance of Excel, I double clicked the saved wb, and my
Test.xla opened via the vb6 dll (test.xla was not installed as an addin).
Seems an odd way of doing things but I guess you have a purpose.
Regards,
Peter T
"Sirhc M" wrote in message
oups.com...
Hi there,
I'm getting a crash when my .dll file (comprising of VB6 6.0.9782 code)
attempts to open an Excel 2000 Add-in (.xla file) comprising of VBA
6.0.8714 code.
Here's the scenario,
1) .dll file is registered with Excel 2000
2) Double clicking on an Excel Workbook in Explorer - Excel Opens,
Workbook Opens
3) .dll file has an appevent associated with the Workbook Open event
4) .dll file triggers the opening of the Excel Add-in
Here's the line where it crashes:
gEventHandler.oXL.Workbooks.Open sXLAPath, 0
where gEventHandler = Event Handler class object
oXl = Excel.Application
sXLAPath = the entire path of the .xla's location (including the
filename.xla)
The crash is something along the lines of "instruction at 0x30033c38
referenced memory at 0x00000002. The memory could not be written"
Any ideas to this problem?
Thansk in advance.
CM
|