Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
PA PA is offline
external usenet poster
 
Posts: 101
Default How to programmatically refrence a .DLL file in Excel

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with Excel file created programmatically bill Excel Programming 3 January 27th 08 10:58 PM
How to programmatically test whether VBA code exists in an Excel file Paul Martin Excel Programming 7 July 3rd 06 06:25 AM
Import csv file into excel programmatically Saumin Excel Programming 1 January 24th 05 10:42 AM
Help with data importing from txt file to excel programmatically SUDHENDRA Excel Programming 2 December 7th 03 02:14 PM
programmatically close help file before Excel closes? RB Smissaert Excel Programming 2 July 21st 03 11:49 AM


All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"