View Single Post
  #6 (permalink)  
Old September 4th, 2003, 10:19 AM
pgtips pgtips is offline
Friend of Wrox
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post

Two common options for writing COMs (ActiveX):
1. use Visual C++ and the ATL COM wizard
2. use Visual Basic and create a new ActiveX DLL project

Whichever you choose, you need at least one public class in your project and any methods you need to call from Excel will need to be declared public too.

There are many tutorials out there about creating COM objects - take a look at a few and ask any questions you may have here.

As for integrating it, you will need a setup program that installs the COM object and registers it - again all standard stuff which you find plenty of examples of on the web.

Once the object is registered you can easily get at it from Excel by setting a refernce to it from within the Excel VB editor (Tools > References), then have code like this:
Dim x As YourProject.YourClass
Set x = CreateObject("YourProject.YourClass")
y = x.YourMethod(param1, param2)


Reply With Quote