Albert D. Kallal
Albert D. Kallal

Reputation: 49329

Late binding of .net CLR in VBA (Access)

In the follow post it shows how one can use VBA, create a instance of the CLR and thus call/use/consume .net COM objects without having to register such objects.

Side-By-Side COM Interop with C# and VBA

I looking to replace this code:

Dim Host As mscoree.CorRuntimeHost
Set Host = New CorRuntimeHost

With

Set Host = createObject("mscoree.CorRunTimeHost")

I am unable to find the "class" name.

In other words, I want to late bind the CLR. Does anyone know if it is possible to use VBA CreateObject() in place of the having a hard reference from VBA to the above mscore

The “reference” set in VBA - > tools is

C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoree.tlb

In effect I looking to late bind use of the .net CLR via CreateObject()

Upvotes: 2

Views: 830

Answers (1)

Comintern
Comintern

Reputation: 22205

I believe you may need to register the typelib first (can't confirm ATM because I used regtlibv12.exe to register it before I went hunting for the class name). The class name appears to be "CLRMetaData.CorRunTimeHost".

Upvotes: 1

Related Questions