Using standard .Net libraries with VBA

前端 未结 2 532
别那么骄傲
别那么骄傲 2021-01-05 07:40

I have successfully been able to run my own .Net code by following the steps posted here Execute .NET 3.0 code from Office 2003

Is there a way to use the standard .N

2条回答
  •  [愿得一人]
    2021-01-05 08:32

    Not yet possible. VBA (VB for Applications) is not VB, but rather a separate deal mimicking all the basic syntax as older versions of VB. It's almost like using a very stripped down version of regular, older VB. In fact, VBScript is the closest match to VBA. Perhaps someday, Microsoft will build in methods to work directly with the GAC, but until then (and that day will likely mean the death of COM I'm sure), you're stuck using COM CreateObject() method, adding a reference to a COM registered library to your Office project, or directly referencing a VBA/COM compatible DLL or TLB file in your Office project.

    There are quite a few COM-enabled libraries in the default GAC, but for the majority, you are stuck creating a Com Callable Wrapper first in VB.Net or C#.

    Conversely, pretty much all MS Office apps are COM callable, so you can work with installed Office apps through VB.Net projects all you want.

提交回复
热议问题