Problems with programatically referening libraries

D

DW

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
 
M

MattShoreson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top