creating a dll

Posted on 2006-03-21
Last Modified: 2010-05-01

I´m creating a dll in vb to use after in vba. When in VBA I use Private Declare Function name Lib "xx" () as string

It tells me when I call to that function that it doesn´t found the dll.

I have read in some articles made by Ron Petrusha that you can´t do this, that you must change the link.exe and create after a .def file.

I know that I would use the dll importing in references the dll and calling this function. But I don´t want to do this.

Has anyone change the link.exe file ?¿?
Question by:1469
    LVL 52

    Accepted Solution

    You don't need to use declare for DLL's created with VB, they are ActiveX. As long as the DLL is registered on the machine you can create an object of a class contained within it by simply using:

       Set obj = CreateObject("YourProject.YourClass")

    Or, if you add a reference:

       Set obj = new YourProject.YourClass

    Hope this helps.

    Author Comment

    Yes but the problem here it´s that I have to registry if I have in a pc the dll in one path and the other in other path ¿?¿? I guess that is easier to have a common dll than this stuff

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now