Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 12-03-2009
Member
 
Join Date: Feb 2009
Posts: 81
Using VBA to a DLL created in VB6

Hello,

As the subject I'm trying to create a dll to use in VBA within Excel. I went to VB6 (which I do not know well) after trying in VB.NET and VC + +. NET because the dll must be COM (ActiveX). But I do not understand how to create a dll readable VBA because I have always problems of "entry point" or initialization of the dll.
Do give me a step by step?
Thanks
Reply With Quote
  #2  
Old 12-03-2009
Member
 
Join Date: Oct 2008
Posts: 167
Re: Using VBA to a DLL created in VB6

Well, we first reduce to zero the errors on DLL ...

Creating DLL in VB6 is quite simple.
First you must open a new project, such as "ActiveX DLL".
This creates a class of default ...

Immediately afterwards go on property tax and some important things:
You must rename the first (before saving) the project with a more meaningful name of "Project1".
Also enter a description "intelligent" in "Project Description", because in many cases it will be the only voice that you will find the lists of the various references used when you will need to import!

You can take the first (and only) class in the "Forms of Class" DLL, delete and / or add others.

I guess you already know everything or almost Property Let / Get Property, Functions or Subs (future methods of DLL ...)
Reply With Quote
  #3  
Old 12-03-2009
Member
 
Join Date: Feb 2009
Posts: 81
Re: Using VBA to a DLL created in VB6

we say that as a result of these questions going to read something more (holy google !)... I do not want you to waste time on things that I can find on the internet ... I thank you instead of the "straight" ... that sometimes make the difference.

go with the two part of the explanation
Reply With Quote
  #4  
Old 12-03-2009
Member
 
Join Date: Oct 2008
Posts: 167
Re: Using VBA to a DLL created in VB6

Quote:
go with the two part of the explanation
Ok, say you have now your beautiful DLL "NomeDll.Dll" properly completed and running, which has 1 class ClasseDll ", which exposes eg. a method ". MetodoDll".
Also in the "Project Description" for example you had specified. "My First DLL v1.0.

Open a new Excel workbook, go into the VBA (the pages with the code ...), then Tools / References. In the list of the many available Ref should already have "My First DLL v1.0. If there is you can always look for the DLL manually with Browse ...
Once added to the Ref workbook, the code key to use the DLL is as follows:

Quote:
Dim nomeIstanza As nomeDll.ClasseDll
Set nomeIstanza = New nomeDll.ClasseDll
nomeIstanza.MetodoDll ()
Reply With Quote
  #5  
Old 12-03-2009
Member
 
Join Date: Feb 2009
Posts: 81
Re: Using VBA to a DLL created in VB6

I apologize if I answer only now but I was messed up until yesterday ...
I tried to do as you say, and the dll contains a form of class within a function with unique and simple:

Code:
 Public Function Sum (ByRef x As Double, ByRef y As Double) As Double 
  Sum = x + y 
  End Function
Then on the excel file I added the dll (sees) that is in the same directory as the excel file. excel the form is as follows:

Code:
 Option Explicit 
  Public Declare Function Sum Lib "mF_colors.dll" (ByRef x As Double, ByRef y As Double) As Double 

  Sub Test () 
          Dim v (10) As Double 
          v (1) = 0.3 
          v (2) = 0.5 
          v (3) = Sum (v (1), v (2)) 
  End Sub
But at this point gives me an error: "Could not find entry point in DLL Sum mF_colors.dll"
What does this mean?
Reply With Quote
  #6  
Old 12-03-2009
Member
 
Join Date: Oct 2008
Posts: 167
Re: Using VBA to a DLL created in VB6

But that is not the method that I suggested myself.
The method is safe to import the Dll of the Rif, as explained above, and invoke methods and properties as follows:

Code:
Dim nomeIstanza As nomeDll.ClasseDll 
      Set nomeIstanza = New nomeDll.ClasseDll 
      nomeIstanza.MetodoDll ()
Then I am not clear why steps 2 Double ByRef numeric values.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Using VBA to a DLL created in VB6"
Thread Thread Starter Forum Replies Last Post
How Objects of class are created in C++? Alibamu Software Development 4 29-12-2010 06:24 AM
Who created Combofix Madhuparna Networking & Security 6 22-07-2010 12:01 AM
How to reset password created in PHP KaramChand Software Development 4 05-02-2009 10:28 PM
Use .Net created dll in VB6 Beter 2 Burn Out Software Development 5 25-10-2008 02:30 PM
XP asking for a password that was never created! Farley Operating Systems 3 24-10-2008 04:24 PM


All times are GMT +5.5. The time now is 12:50 PM.