AccessBlog.net

News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Alex
Name:Alex Dybenko

Location:Moscow, Russia

Saturday, September 05, 2009

How to use .NET assembly in VBA

Example with detailed steps: Consuming .NET components within Access/VBA

Labels: ,

3 Comments:

Blogger Alex Dybenko said...

Update from John Mishefske:
I had to modify the VBA code in the modBigInt module in the
BigMathInAccess.mdb file to successfully run the sample.

The ProgID for this class library is BigIntX and the main class is
BigInt so I had to modify this:

Public Sub earlybinding()

Dim big As New BigInt.BigInt

Debug.Print big.multiply("3", "4", 10)
Debug.Print big.divide("16", "2", 10)
Debug.Print big.modulo("9", "10", 10)

End Sub

to this

Public Sub earlybinding()

Dim big As New BigIntX.BigInt

Debug.Print big.multiply("3", "4", 10)
Debug.Print big.divide("16", "2", 10)
Debug.Print big.modulo("9", "10", 10)

End Sub

NOTE: The X after "BigInt" in the ProgID.

and once I did the VBA compiled and ran successfully.

Great sample and demonstrates that Access can potentially do anything
that a .Net program can!

4:18 PM  
Anonymous Fred Finet said...

Could you help me on this :
Whatever I do, I get the followin error when using the object on VBA :

"File or assembly name BigIntX, or one of its dependecies, was not found."

This occurs with the eraly binding and late dinding versions of the object.
Note that they appear properly in the object browser.

Even stranger, if I want to regenerate the TLB with regasm, I have to close excel, which seems to indicate the tlb was properly loaded...

Any idea ?

4:01 PM  
Blogger DataPlus - Custom Data Services said...

I've been scratching the surface of .net but would like to learn more. I like that it can integrate with Access through VBA.

10:17 PM  

Post a Comment

Links to this post:

Create a Link

<< Home