#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default activeX dll

I have build a dll by Visual basic
How can I import the dll file on runtime ?


  #2   Report Post  
Posted to microsoft.public.excel.programming
moi moi is offline
external usenet poster
 
Posts: 27
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveX need help Mary Excel Programming 0 March 21st 05 03:51 AM
ActiveX HELP!! Lori~ Excel Programming 3 March 10th 05 10:37 PM
ActiveX RedChequer Excel Discussion (Misc queries) 0 March 9th 05 11:05 PM
ActiveX add-in? [email protected] Excel Programming 7 January 21st 05 01:04 PM
activeX batty Excel Programming 0 September 18th 04 04:13 PM


All times are GMT +1. The time now is 03:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"