Late binding of .net CLR in VBA (Access)

霸气de小男生 提交于 2019-12-24 03:22:22

问题


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()


回答1:


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".



来源:https://stackoverflow.com/questions/30020604/late-binding-of-net-clr-in-vba-access

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!