Maybe you could just close that addin when you open your workbook and reopen the
addin when you close your workbook???
Option Explicit
Const AddinPath As String = "c:\excel\" '<- include that trailing backslash!
Const AddinName As String = "DemoAddinNameHere.xla"
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim TestWkbk As Workbook
Dim Resp As Long
Set TestWkbk = Nothing
On Error Resume Next
Set TestWkbk = Workbooks(AddinName)
On Error GoTo 0
If TestWkbk Is Nothing Then
Resp = MsgBox(Prompt:="Wanna open " & AddinName & "?", Buttons:=vbYesNo)
If Resp = vbYes Then
'open it
Workbooks.Open Filename:=(AddinPath & AddinName)
End If
End If
End Sub
Private Sub Workbook_Open()
On Error Resume Next
Workbooks(AddinName).Close savechanges:=False
On Error GoTo 0
End Sub
=========
If you were really industrious, you could open/close the addin when you
deactivate/activate your workbook.
powlaz wrote:
>
> I am interested in knowing if it is possible to disable an add-in in the
> workbook open event using VBA. I have just identified a problem with the
> Dymo LabelWriter add-in that is causing one of my workbooks to error out.
>
> Since we don't need the Dymo printer (or any printer) for this workbook I
> would like to disable the add-in. Please tell me how I can do this. I speak
> pretty poor VB so an example is much appreciated.
>
> Thanks,
>
> MJ
--
Dave Peterson
|