ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problems with programatically referening libraries (https://www.excelbanter.com/excel-programming/361565-problems-programatically-referening-libraries.html)

DW

Problems with programatically referening libraries
 
Hi Damon,

I have attempted to use the references collection ... with little success!

I wanted to reference an Outlook Object library, depending on the version of
Outlook that was installed on the user's machine. I seached their harddrive
for the appropriate library, and then attempted to "tick" that reference
using the refs collection. This particular library was already in the
reference list (unchecked), and would not allow me to add another ref with
the same name!!!

Do you know of a way to check items (programatically) within the "references
Dialog?

cheers,
DW

MattShoreson[_109_]

Problems with programatically referening libraries
 

I've used the below before...

...the main part for checking/unchecking is to use the .installed.

Function Load_XL_AddIn(strFilePath As String, strAddInName As String)
As Boolean
Dim addXL As Excel.addin

On Error Resume Next
strAddInName = Left(strAddInName, Len(strAddInName) - 4)

Set addXL = Excel.AddIns(strAddInName)
If Err < 0 Then
Err.Clear

Set addXL = Excel.AddIns.Add(strFilePath, 1)
If Err < 0 Then
Load_XL_AddIn = False
GoTo Load_XL_AddIn_End
End If

End If

If Not addXL.Installed Then addXL.Installed = True
Load_XL_AddIn = True

Load_XL_AddIn_End:
Exit Function
End Function


--
MattShoreson
------------------------------------------------------------------------
MattShoreson's Profile: http://www.excelforum.com/member.php...fo&userid=3472
View this thread: http://www.excelforum.com/showthread...hreadid=542378



All times are GMT +1. The time now is 02:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com