View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default How to late-bind Excel

maurizio,
Your Delphi DLL would need some Property/Function that accepts "MyXL As
Object", as you want to use late binding, hence you cannot use "MyXL As
Excel.Application".
GetObject is irrelevant in early versus late binding : It is whether you set
a reference to the required library (and hence you can use the exposed
objects) versus no such reference (and everything is a generic Object).

In VBA, something like:
Set MyDelphiDLL.SetXLInstance=Application

where you Delphi DLL has a Property (whatever this VB is in Delphi)
Property Set SetXLInstance (vData As Object)
'vData is no your Delphi reference to the Excel instance

NickHK

"maurizio" wrote in message
oups.com...
I'm using a DLL (written in Delphi) from VBA in order to access a db
server.
As in any case i have a dll initialization, i'd like to provide the dll
with a late
binding to Excel. I don't like GetObject, because you're never sure
WHICH
instance of Excel are you hooking into.

On the other side, many years ago i knew how to pass in the
initialization
routine an Excel reference (i guess it was Excel.Application: converted
to a long?)
and how to retrieve from this a correct reference to Excel inside the
dll initialization
routine. Unfortunately i forgot how to do this: anyone with a solution
to this ?