Maybe you could use a Workbook Name that you add in each workbook:
Option Explicit
Sub auto_open()
ThisWorkbook.Names.Add Name:="HasOwnCode", RefersTo:="True", Visible:=False
End Sub
Then in your application event code, you can check for it.
Option Explicit
Sub testme01()
Dim testVal As Boolean
testVal = False
On Error Resume Next
testVal = Evaluate(ActiveWorkbook.Names("HasOwnCode").Refers To)
On Error GoTo 0
If testVal = False Then
MsgBox "continue with application event"
Else
MsgBox "don't continue"
End If
End Sub
Dave wrote:
I have an addin I created that uses an event class that
fires before close event of any book at to catch when a
book is being closed and prompts me via msgbox to ask if I
want to add any reminder notes (docuemntation)to the file.
If yes then I add text to cells on a specific sheet as
needed. I use this to track file modfications during
design, debug and ongoing use.
My issue is that while I have this as an addin myself, I
sometimes put the same code is specific workbooks that
others use soe that they can document/add notes as they
use books that are shared from time to time on the server.
As a result for these books I get the msgbox firing twice--
once on book close caught by the addin and once by the
book close event code of the book itself.
I'm looking for suggestions on how to have the addin
ignore the close if the book also has the code.
Option I've considered: Putting a dummy true/false value
in some specific cell of the book with the duplcate code,
and testing the value thru the addin.(problem if the sheet
gets deleted accidently)
Are there any better approaches you can recommend? ie any
properties I could test?
Dave
--
Dave Peterson