Problems checking for an Addin
gimme_this_gimme_that,
I get an Error, "Invalid use of Me Keyword"
--
Trefor
" wrote:
This might be useful to you.
A means to check if a reference exists from a template and a method to
remove the reference later so others can read the Workbook you created
from the Template and the AddIn.
Put these Subs into the Template:
Private Sub Workbook_Open()
If ReferenceExists("MyAddInName") Then
' call StartUpSub in the NameOfAddInModule
NameOfAddInModule.StartUpSub Me
End If
End Sub
Private Function ReferenceExists(reference As String) As Boolean
Dim result As Boolean
result = False
On Error Resume Next
result = Not Me.VBProject.References(reference) Is Nothing
ReferenceExists = result
End Function
Then in the Template call this:
Public Sub RemoveReferences(book As Workbook)
book.VBProject.References.Remove
book.VBProject.References("MyAddInName")
End Sub
|