Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
activeX dll
I have build a dll by Visual basic
How can I import the dll file on runtime ? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
activeX dll
http://www.geocities.com/smplprgrsrc/files/DLL_DEMO.zip
Very simple sample. Don't forget to add the dll to your references, that's also the trick in VBA. "eRic" schreef in bericht ... I have build a dll by Visual basic How can I import the dll file on runtime ? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
activeX dll
"eRic" wrote in message
... I have build a dll by Visual basic How can I import the dll file on runtime ? I'm assuming your DLL contains at least one MultiUse or GlobalMultiUse class and that it's been properly registered on the machine where you want to use it. Otherwise you won't be able to access it from VBA. There are one of two ways to use an ActiveX DLL from VBA: 1) Set a reference to the DLL using the Tools/References menu in the Visual Basic Editor. You can then declare object variables to represent objects in your DLL and otherwise use it exactly like you'd use any other class. You should always prefix any class names from your DLL with the name of the DLL itself to avoid any name collisions. For example, if you DLL is called MyDll and it has a public class called MyClass you would do this: Dim clsClassRef As MyDll.MyClass Set clsClassRef = New MyDll.MyClass ''' Use the clsClassRef variable here Set clsClassRef = Nothing 2) You can use your DLL without a reference by using the late-binding technique. This requires you to declare all the variables that reference your DLL "As Object" and use the CreateObject function to acquire references for them. Using the same scenario as above, this would be: Dim objClassRef As Object Set objClassRef = CreateObject("MyDll.MyClass") ''' Use the objClassRef variable here Set objClassRef = Nothing -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ActiveX need help | Excel Programming | |||
ActiveX HELP!! | Excel Programming | |||
ActiveX | Excel Discussion (Misc queries) | |||
ActiveX add-in? | Excel Programming | |||
activeX | Excel Programming |