Posted to microsoft.public.excel.programming
|
|
Adding reference in code
Thank you so much, Chip. This is exactly what I was looking for.
"Chip Pearson" wrote in message
...
Andrew,
Try something like the following:
ThisWorkbook.VBProject.References.AddFromFile _
Filename:=Application.AddIns("addin_name").FullNam e
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Andrew O'Brien" <trinitywallstreet.org@aobrien wrote in message
...
Thanks for the prompt reply. I'm looking to programatically add a VB
Reference, not an Add-In. Is it possible? In the second example you
provided, you are demonstrating late-binding. I'm looking for a way to
add
a reference to an .xla file so that the public functions in that .xla
file
are available for use in the current workbook.
Thanks,
Andrew
"AA" wrote in message
...
To add an XLA file:
AddIns("ODBC Add-in").Installed = True
ODBC Add-in is added; setting to False removes it.
If a Win32 DLL, then something like:
Declare Function CopyFile Lib "kernel32" Alias "CopyFileA"
(ByVal lpExistingFileName As String, ByVal lpNewFileName
As String, ByVal bFailIfExists As Long) As Long
The DLL is KERNEL32.DLL, the function is CopyFile (the
arguments must be known).
If an ActiveX DLL (or EXE)
Set Myobj=CreateObject(name.class)
e.g.
Set objWrd=CreateObject("Word.Application")
Set objAPL=CreateObject("APLW.WSEngine")
-----Original Message-----
Hello all,
Is there a way to programatically add a reference to a
dll or .xla file from
an Excel workbook? (i.e. ToolsReferences from the VB
Editor) .
Thanks,
Andrew
.
|