Results 1 to 5 of 5

Thread: Using VB.NET Class library in VBA

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    4

    Question Using VB.NET Class library in VBA

    I built a Class Library named PM-Activa.dll in Visual Studio.Net using VB.NET. It works fine from within another windows application built in Visual studio.Net.

    Q: How can I use it from a VBA module (Excel or Access)?
    (I use Access 2000 of Excel 2000 and Windows XP Pro)
    When i try to reference the file PM-Activa.ddl i get a message saying that i can't put a reference to the specified file?
    Greetings from Holland

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You'd have to convert it into a COM wrapper. I'm not sure of everything you have to do but the upgrade wizard adds this to the start of the class:
    <System.Runtime.InteropServices.ProgId("cDay_NET.cDay")> _
    Public Class cDay

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    4

    Unhappy

    I understand that i have to convert it into a COM (callable?) wrapper. I searched at MSDN for more information. There was a lot of it there. Mostly about using older COM components in VB.NET. But i still have no idea of what i should do. What actions should i take with the .dll up to referencing it from within VBA?
    Greetings from Holland

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    I dont know much about it, but you might want to look into VSA which is, I believe, the new thing to replace VBA and has .NET support so it can fully utilize .NET. I dont know much about it though, just bits and pieces Ive seen mentioned in .NET magazine.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    4

    Cool

    Surprisingly I found out myself. The job can simply be done using the regasm.exe program which part of the .Net Framework Tools.

    From the command prompt you use this syntax:
    regasm AssemblyPath /tlb:FileName.tlb

    When the dll file is PM_Activa.dll like in my case you use:
    regasm PM_Activa.dll /tlb:PM_Activa.tlb
    With this program both are registered on your computer. Now you can choose this from the list of references in your VBA program. For instance Access or Excel.



    I hope anyone else can use it to convert you VBA applications step by step into VB.NET.
    Greetings from Holland

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width