View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Get default add-in path

What is the best way to get the default .xla add-in path?

Will this always be Application.UserLibraryPath ?

Or should I use a function like this:

Function GetDefaultAddinPath(Optional strIdentifier _
As String = "\addins\") As String

Dim i As Long
Dim lCount As Long
Dim lPos As Long

strIdentifier = UCase(strIdentifier)
lCount = Application.AddIns.Count

For i = 1 To lCount
lPos = InStr(1, UCase(Application.AddIns(i).FullName), _
strIdentifier, _
vbBinaryCompare)
If lPos 0 Then
GetDefaultAddinPath = Left$(Application.AddIns(i).FullName, _
lPos + Len(strIdentifier) - 1)
Exit Function
End If
Next i

End Function


RBS