Results 1 to 7 of 7

Thread: RegFree .NET dll consume from VB6 and VBA

  1. #1

    Thread Starter
    Addicted Member Davor Geci's Avatar
    Join Date
    Sep 2009
    Posts
    222

    Question RegFree .NET dll consume from VB6 and VBA

    Hello guys,

    I've created a dll in VB.NET to connect vb6 apps and VBA projects to Azure cloud (Application Insight) to monitor and log performance and usage of vb6 apps and VBA documents in real-time async.

    Now, to be able to use it on users machines I need to run the setup or register it with regasm.
    This dll is also having some referenced that it uses.
    Long story short, is there a way to consume this dll with late binding but without registering in (and his references) on a user machine from vb6 apps and mainly from VBA (Excel)?

    Thanks for your suggestions and advice,

    Davor
    Last edited by Davor Geci; Mar 30th, 2018 at 10:26 AM.
    My projects:
    Virtual Forms
    VBA Telemetry

  2. #2
    Lively Member
    Join Date
    Mar 2018
    Posts
    64

    Re: RegFree .NET dll consume from VB6 and VBA

    Quote Originally Posted by Davor Geci View Post
    Hello guys,

    I've created a dll in VB.NET to connect vb6 apps and VBA projects to Azure cloud (Application Insight) to monitor and log performance and usage of vb6 apps and VBA documents in real-time async.

    Now, to be able to use it on users machines I need to run the setup or register it with regasm.
    This dll is also having some referenced that it uses.
    Long story short, is there a way to consume this dll with late binding but without registering in (and his references) on a user machine from vb6 apps and mainly from VBA (Excel)?

    Thanks for your suggestions and advice,

    Davor
    FYI -- Registration-Free Activation of COM Components: A Walkthrough

  3. #3

    Thread Starter
    Addicted Member Davor Geci's Avatar
    Join Date
    Sep 2009
    Posts
    222

    Re: RegFree .NET dll consume from VB6 and VBA

    gyhu thanks for your response,

    In this article, as I can see, they use manifest files for this RegFree approach.

    But in case of VBA, we can't modify Excel, Access or Word manifest files. Is there maybe another approach?
    My projects:
    Virtual Forms
    VBA Telemetry

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,386

    Re: RegFree .NET dll consume from VB6 and VBA

    I think that the people in the Office forum might be able to answer that one better, so I've moved the thread there, though I've also left the redirect such that it will last longer than normal.
    My usual boring signature: Nothing

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: RegFree .NET dll consume from VB6 and VBA

    have a look at this post, see if it is useful
    http://www.vbforums.com/showthread.p...rectCOM-Helper
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  6. #6
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,435

    Re: RegFree .NET dll consume from VB6 and VBA

    First you need to create an assembly manifest for the .net assembly and embed it in the dll. Then you create application manifest and embed it in your VB6 exe. Look at this SO question for detailed explanation.

    In VBA you have to use an activation context (an instance of Microsoft.Windows.ActCtx) instead of embeding the app manifest in Word/Excel exe.

    Just load the application manifest and then call CreateObject for .net classes like this
    thinBasic Code:
    1. Set oCtx = VBA.CreateObject("Microsoft.Windows.ActCtx")
    2. oCtx.Manifest = sFile
    3. Set RetVal = oCtx.CreateObject(sProgID)
    cheers,
    </wqw>

  7. #7
    Lively Member
    Join Date
    Mar 2018
    Posts
    64

    Re: RegFree .NET dll consume from VB6 and VBA

    Quote Originally Posted by Davor Geci View Post
    gyhu thanks for your response,

    In this article, as I can see, they use manifest files for this RegFree approach.

    But in case of VBA, we can't modify Excel, Access or Word manifest files. Is there maybe another approach?
    You're welcome.

    Another reference for you: Reg-Free COM at runtime via Microsoft.Windows.ActCtx

Tags for this Thread

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