How to programmatically refrence a .DLL file in Excel
So you have already set a reference in prjName.xla to your dll
Select prjName.xla in the left panel
Start Object Browser, F2
In the top dropdown select your dll
Look in the "Classes" window below for public classes you will be able to
create
In the "Members" window look at functions and procedures you can call
Lets say your dll is named "myDllName.dll", which has a public class named
"clsEntry", with a function named "Foo", which has some arguments. Note the
"type" of arguments in Object Explorer and also the "type" that the function
returns (if any). In your addin you should be able to do something like this
Dim cFuncs As myDllName.clsEntry
Set cFuncs = New myDllName.clsEntry
result = cFuncs.Foo(arg1, arg2)
Above assumes your dll is an ActiveX dll, ordinary dlls you would use with
the "Declare" statement like API's.
Regards,
Peter T
"PA" wrote in message
...
I have developed a program which makes use of ccrpTmr.dll file located in
the
folder C:\MyDocuments (which also houses the main Addin file).
I want to programmatically enroll this dll file along with the addin file
when a workbook is opened.. Using
Private Sub Workbook_Open()
Application.Addins.Add("C:\MyDocuments\prjName.xla ")
Addins("C:\MyDocuments\prjName.xla").Installed=Tru e
End sub
the addin is not only enrolled in the collection but also installed
(checked) in the Addins dialog box under Tools---Addins.
For now, the dll file is manually loaded the usual way (In the VBE,
Tools--References--Browse etc).
Any leads will be appreciated
PS: This is a repeat post as the first went unansewered
PA
|