Dima Railguner
Dima Railguner

Reputation: 173

How to make activeX dll in Delphi XE and add it to Excel VBA project like a reference

I have a question. How to make activeX dll in Delphi XE and add it to Excel VBA project like a reference.

I made the usual activeX library (file -> new -> other -> activeX -> activeX Library). Wrote several functions and procedures inside it. And build. So I have "SomeActiveXLibrary.dll"

Now I'd like to use my dll in vba project in excel. In vba IDE I push tools->references->browse->"SomeActiveXLibrary.dll" and see "can't add a reference to the specified file".

What am I doing wrong?

Upvotes: 1

Views: 2292

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 598309

Like Ken White said, you have only done half of what is needed to make a viable ActiveX DLL. You created the DLL itself, but did not put an ActiveX object inside of it. After using "File > New > Other > ActiveX > ActiveX Library", you need to then use "File > New > Other > ActiveX > COM Object" to add an ActiveX/COM object to the library. Then you can flesh out the generated TypeLibrary and implementation class with your custom functions as needed, compile the DLL, and register it. Then VB/VBA should be able to use it.

Upvotes: 2

Related Questions