Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a DLL file in Excel

Status
Not open for further replies.

popper

Programmer
Dec 19, 2002
103
AU
Presuming that I can generate a DLL file using VB something (Express 2005 maybe - can't do it in VBA I understand??), how do I use this in an Excel application. For example, can I call one of the functions in the DLL file from a regular macro. How do I load a DLL. Is is similar to an xla addin? Any help would be appreciated.

Thank you.

 
DLLs have to be registered - from a command line: regsvr32 <path & filename of dll>. Once registered, they can be referenced like any other library file, so yes, you can call functions in it.

Gerry
My paintings and sculpture
 
Thank you Gerry for your prompt and helpful reply. I am almost there. Except when I run the regsvr32 command and point it to my test DLL file I get the following:
"c:\dlltest.dll was loaded, but the DlRegisteredServer entry point was not found. This file cannot be registered."

Can you tell me what is missing?

With thanks

 
I create COMs and then use the .tlb instead of the dll. This works well, and you don't have to register it.

Also, your entry point is probably a sub Main().

I hope this helps.

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Thanks Ron. I tried that but same error message results. Your idea pointed me towards the dllmain function and I copied working code from another help resource but ....still no luck.

I will persevere.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top