
Accessing a COM object of a COM object
Hi,
I would advice you against using properties, for two reasons, for one, you
are going to need a module level variable, and two if you are going to use
COM+, you are not giving any safety for your data, unless you are going to
make your object persistent, in which case, you again incure overheads. If
you are not using COM+, then it is fine.
I would suggest, you have a method in your class to invoke the excel
application, and the mothod should return an instance of the same to the
caller. The caller can then directly do whatever it wants with the instance.
Just ensure that if your class gets called in between, you take the Excel
handle as a parameters to all your calls.
HTH
Kartik R.
Quote:
> I am writing an interface for a COM object, which itself
> can initialize an external instance of MS Excel. The end
> client program, written in VB, needs to get access to the
> instance of Excel through my interface and take control of
> the Excel instance directly. Does anyone know how to do
> this properly? I was planning on using a read/write
> property of my interface to pass the pointer to the Excel
> instance to the VB program, but I don't know if that will
> work or how to receive the pointer in VB so I can
> manipulate the Excel instance directly.
> Any help would be appreciated.
> Thanks, Kollin