Hi all,
I have also posted this appeal for help to a google group, but I don't see much activity there. This forum seems more on target for my problem.
I am trying to access .Net components from Excel 97. For testing I am following an example presented in a 2001 posting by Manish Mehta at:
http://www.c-sharpcorner.com/articles/accessingdotnetfromcom.asp
Source code for the VB.Net component is:
imports system
namespace CCWComponent
public class CCWClass
public function PassStr as string
PassStr = "Hi from .Net Component"
end function
end class
end namespace
I compile the above with: 'vbc /t:library testCCW.vb' and register with: 'regasm testCCW.dll /tlb:testCCW.tlb'. (The /tlb switch is used to allow testing of early as well as late binding.)
When I open the VB Editor in a new Excel 97 workbook and navigate to Tools/References, a reference to 'testCCW' does show up.
Within the workbook I create the following macro to invoke the CCWClass.PassStr method when the workbook is opened.
Private Sub Workbook_Open()
Dim o As Object
Set o = CreateObject("CCWComponent.CCWClass")
MsgBox o.PassStr
End Sub
The problem is that when I open the workbook the following error appears with the macro stopped at the 'Set o = ...' statement.
Run-time error '-2146232576(80131700)':
Automation error
I am pretty much clueless about how to locate the source of this problem. Any information or suggestion about resolving it would certainly be appreciated.
Ennis