abhiker
07-14-2008, 01:01 PM
i am trying to uninstall an addin when i close my file. when i open certain files, i install it then. so i don't alway need the addin. this is the code i tried to use but it doesn't seem to do it. any help is greatly appreciated.
Dim bIsClosing As Boolean
' in case the user cancel the file close
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = False
bIsClosing = Not Cancel
End Sub
Private Sub Workbook_Deactivate()
On Error Resume Next
If bIsClosing = True Then
Application.AddIns("IclAddIn").Installed = False
End If
On Error GoTo 0
End Sub
Dim bIsClosing As Boolean
' in case the user cancel the file close
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = False
bIsClosing = Not Cancel
End Sub
Private Sub Workbook_Deactivate()
On Error Resume Next
If bIsClosing = True Then
Application.AddIns("IclAddIn").Installed = False
End If
On Error GoTo 0
End Sub