Using COM objects in Excel or VBA?

  • Thread starter Thread starter Afshar Mohebbi
  • Start date Start date
A

Afshar Mohebbi

Hello everybody there,

I wan to use a COM (I've written in VC++) in Excel using its VBA. I
want to retreive some data with this COM and add it to a Excel
worksheet.
Is it possible? How?

Thanks in Advance,
Afshar Mohebbi
 
Hello Afshar Mohebbi,

Your question is really to in depth to answer by post. Microsoft has a
good site that should answer your questions. Here is the site to visit
http://tinyurl.com/ltl2w

Sincerely,
Leith Ross
 
Hi Leith,
But this link seems to be about the COM itself, not using it in Excel.
I've already written and used COM in several cases.

Regards,
Afshar
 
Afshar,
Basically, you need to add a reference to your components from the Excel
VBE>Tools>References.
Then :
Dim MyInstance As MyCom.MyClass
Set MyInstance=New MyCom.MyClass

With MyInstance
.Dosomething argument1,etc...
End With

'Finished, so free up
Set MyInstance=Nothing

NickHK

Afshar Mohebbi said:
Hi Leith,
But this link seems to be about the COM itself, not using it in Excel.
I've already written and used COM in several cases.

Regards,
Afshar
 
Hi after a month!!

NickHK,
It was very helpfull, I use it in ESRI ArcGIS (ArcMap) a GIS
application and it worked well.

Thanks Again
Afshar

Afshar,
Basically, you need to add a reference to your components from the Excel
VBE>Tools>References.
Then :
Dim MyInstance As MyCom.MyClass
Set MyInstance=New MyCom.MyClass

With MyInstance
.Dosomething argument1,etc...
End With

'Finished, so free up
Set MyInstance=Nothing

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top