Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA
Go Back  Xtreme Visual Basic Talk > > > Call VB.Net DLL from Excel VBA


Reply
 
Thread Tools Display Modes
  #1  
Old 04-04-2006, 02:16 PM
GaryMinor GaryMinor is offline
Newcomer
 
Join Date: Apr 2006
Posts: 2
Question Call VB.Net DLL from Excel VBA


How do I call a vb.net dll from an excel VBA macro?

1) I created a keypair using: sn -k mykeypair.snk

2) I added to the .vb file: <Assembly: AssemblyKeyFile("mykeypair.snk")>

3) I created a dll by compiling the project. (The DLL works when called from another dotnet project.)

4) I created a Type Library using: regasm MyDotNetProject.dll /tlb:MyTypeLibrary

5) In the VBA macro IDE, I added a reference to MyTypeLibrary.

The class is in the list When I use the object browser to look for the newly referenced object,
but there are no methods shown. I assume that this is a problem rather than just a quirk.
Note: The class and all of the methods are Public.

Even when I solve the above problem, How do I use the class and its methods.
That is, what is the syntax of the calls?

Any help you can give would be appreciated. Articles, documentation, or examples are welcome.

Thanks,
Gary Minor
Reply With Quote
  #2  
Old 04-04-2006, 03:32 PM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Hey Gary,

Welcome to the forum.

In short, you need to expose your assembly to COM using the correct attributes.

Here are a few links to get you started:

(1) VB.net and Excel references
(2) http://support.microsoft.com/Default.aspx?kbid=817248
(3) http://msdn.microsoft.com/library/de...nentstocom.asp

We'll also get this post moved over to the .NET Office Interop Forum for you...

-- Mike
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
  #3  
Old 04-05-2006, 01:36 PM
GaryMinor GaryMinor is offline
Newcomer
 
Join Date: Apr 2006
Posts: 2
Thumbs up

Mike ,

Thanks for your help. #2 link was the answer. I has the detail I needed.

http://support.microsoft.com/Default.aspx?kbid=817248

Gary
Reply With Quote
  #4  
Old 04-05-2006, 01:48 PM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Yeah, I thought that #2 would be the ticket...

Glad it worked.
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA
 
Call VB.Net DLL from Excel VBA
Call VB.Net DLL from Excel VBA
 
-->