Results 1 to 6 of 6

Thread: Using VBA to a DLL created in VB6

  1. #1
    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

  2. #2
    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 ...)

  3. #3
    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

  4. #4
    Join Date
    Oct 2008
    Posts
    167

    Re: Using VBA to a DLL created in VB6

    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:

    Dim nomeIstanza As nomeDll.ClasseDll
    Set nomeIstanza = New nomeDll.ClasseDll
    nomeIstanza.MetodoDll ()

  5. #5
    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?

  6. #6
    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.

Similar Threads

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,898,150.17784 seconds with 16 queries