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
VB6 to access objects in VBA code (Read 2316 times)
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
VB6 to access objects in VBA code
20.03.07 at 16:39:26
 
VB6 to access objects in VBA code
 
From a VB6 dll I tried to access an object instantiated in an Excel addin. This can be done through the Excel Appplication.Run function.
 
In the VB6 dll I created an instance of Excel using:
Dim xl as Excel.Application
Set xl = New Excel.Application

 
The addin starts with Excel. Inside the addin I coded in a module the following function:

Public Function getObject as Object
  Set getObject = MyObject
End Function

 
MyObject is an object the addin created. I want to be able to call methods inside the object and to have access to its properties in the VB6 dll. In the dll I added the following code to achieve this:
 
Dim obj as Object
Set obj = xl.Run("myaddin.xla!getObject")
obj.amount = 50
obj.Calculate
msgbox obj.Value

 
Simpel but effective and it works like a charm!
Back to top
 
« Last Edit: 20.03.07 at 16:40:21 by Gerrit-Jan Linker »  

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