View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ryan H Ryan H is offline
external usenet poster
 
Posts: 489
Default Test If Add-In Workbook is being Referenced

Sorry for the slow response Jacob. I tried this code below and it doesn't
seem to find my add-in.

Sub FindAddIn()

Dim myAddin As Variant

For Each myAddin In Application.AddIns
If myAddin.Name = "QG Add-In.xla" Then
MsgBox myAddin.Installed
End If
Debug.Print myAddin.Name
Next

End Sub

This is what was printed in the Immediate Window:
ANALYS32.XLL
ATPVBAEN.XLA
SUMIF.XLA
EUROTOOL.XLA
EG2000.xla
HTML.XLA
LOOKUP.XLA
SOLVER.XLA

Let me explain exactly what I'm looking for maybe you can give me another
clue of what to do. I have a workbook named "QUOTE GENERATOR.xls". I added
a Reference workbook by selecting ToolsReferences then selected "QG
Add-In.xla" in the VBA Editor. "QG Add-In.xla" contains all of the code and
userforms and "QUOTE GENERATOR.xls" stores data to be used in the userforms.
Sometimes there may be instances where "QUOTE GENERATOR.xls" is open multiple
times and all of those instances access the "QG Add-In.xla". The problem is
when all the copies of "QUOTE GENERATOR.xls" are closed, but Excel
Application is not closed the "QG Add-In.xla" remains open. I would like to
have code that can detect if any workbooks are referencing "QG Add-In.xla",
is that possible?

--
Cheers,
Ryan


"Jacob Skaria" wrote:

Ryan, have you tried this; if this does not work let me know...

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

Try
Msgbox AddIns("analysis toolpak").Installed

'You can check for the other available Add-Ins
Sub Macro()
For Each myAddin In Application.AddIns
If myAddin.Name = "ATPVBAEN.XLA" Then
MsgBox myAddin.Installed
End If
Next
End Sub



If this post helps click Yes
---------------
Jacob Skaria


"Ryan H" wrote:

I have an Add-In Workbook that contains userforms and code which is
referenced by other workbooks. This is my problem, I may have 4 workbooks
open referencing the add-in wbk. If all those workbooks close, but the Excel
application remains open, my add-in does not close. Is there a way to put
code in the add in wbk to check to see if any workbooks are referencing it
and if not close the add-in?

Thanks in Advance!
--
Cheers,
Ryan