Linker IT Software
Google
Web www.oraxcel.com
menubar-top-links menubar-top-rechts
Home Help Search Login
Welcome, Guest. Please Login.
SQL*XL: Database to Excel bridge litLIB: Excel power functions pack ExcelLock: Locking and securing your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe encOffice: Protect your Excel file easy and safe
Pages: 1
Using Excel UDF's from a VB6 ActiveX dll (Read 2386 times)
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Using Excel UDF's from a VB6 ActiveX dll
04.11.09 at 15:16:32
 
Using Excel UDF's from a VB6 ActiveX dll
 
To use functions written in a VB6 ActiveX dll (an ActiveX .exe should work similar) in Excel (Excel 2002 or higher) you need to do the following:
 
  • Create a ActiveX dll project
  • Add a class file to the project (e.g. called class1)
  • Set the properties of this class to instancing=6 - GlobalMultiuse
    This ensures the functions inside the class will be available outside the class as well without declaration.
  • Write your functions inside the class.
    Example testing function:
    Public Function MyTest() as Variant
      MyTest = "Hi"
    End Function
  • Compile the project to create the ActiveX dll
  • In Excel add the COM addin: tools->Addins->Automation
  • Select yourproject.class1

 
That's it. Now you should be able to type the function into an Excel cell:
=MyTest()
And it should display: Hi
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Pages: 1