Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.automation,microsoft.public.office.developer.vba
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 . |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you have added an addin, either with
AddIns("ODBC Add-in").Installed = True or with Tools|AddIns etc, the functions in that XLA become available. You can use them in the worksheet =fnname(arg1,,arg2) or in macros ActiveCell.FormulaR1C1 = "=fname(arg1,,arg2)" IF you need the value in the macro, read it from the activecell or other cell where you have written it. -----Original 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 . . |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You're right. I'm sorry, I don't think I was clear about what I was looking
for. I needed to make the external formulas available on the document level...not the Excel application level. For example, if I create workbook wb1.xls, I want to have a reference saved with the workbook to lib1.xla so that I don't have to worry about whether or not another user has the add-in installed. Thanks again. "AA" wrote in message ... If you have added an addin, either with AddIns("ODBC Add-in").Installed = True or with Tools|AddIns etc, the functions in that XLA become available. You can use them in the worksheet =fnname(arg1,,arg2) or in macros ActiveCell.FormulaR1C1 = "=fname(arg1,,arg2)" IF you need the value in the macro, read it from the activecell or other cell where you have written it. -----Original 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 . . |
#8
![]()
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.automation,microsoft.public.office.developer.vba
|
|||
|
|||
![]()
Andrew,
Try something like ThisWorkbook.VBProject.References.AddFromFile _ Filename:="C:\filename.xla" -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Andrew O'Brien" <trinitywallstreet.org@aobrien wrote in 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
adding an autoshape to vba code | Excel Discussion (Misc queries) | |||
Adding code to a macro | Excel Worksheet Functions | |||
adding a phone area code that is not there | Excel Discussion (Misc queries) | |||
adding and subtracting using vb code | Excel Discussion (Misc queries) | |||
bar code help, adding asterix to reference | Excel Discussion (Misc queries) |