M
Matthew Pfluger
I am trying to write a "Setup" workbook to install or uninstall an addin.
The uninstall code looks like this (simplified):
Function bUninstallAddin(ByVal sAddinName As String, _
ByVal sAddinSourceFilepath As String) As Boolean
' Attempt to close addin in case it is open
On Error Resume Next
' ******************************************
' Code stops after executing the line below
AddIns(sAddinName).Installed = False
On Error GoTo ErrorHandler
' Delete pre-existing registry keys (if any)
If Not bDeleteAddinRegistryKey(sAddinName) Then Err.Raise glHANDLED_ERROR
bUninstallAddin = TRUE
End Function
When the function above closes the target addin, the addin runs an
Auto_Close script to remove commandbars, save settings, and shut down.
However, that code causes code execution to stop, and I want the uninstall
macro to continue.
Here's the Auto_Close routine from the target addin:
Public Sub ShutdownApplication()
On Error Resume Next
Application.ScreenUpdating = False
' This flag prevents this routine from being called a second time
' by Auto_Close if has already been called by another procedure.
gbShutdownInProgress = True
' Do a bunch of things here....
' Continue if not in debug mode.
' ******************************************
' Code stops after executing the line below
If Not gbDEBUG_MODE Then ThisWorkbook.Close False
End Sub
Is there any way to run the shutdown script without terminating code
execution?
Thanks.
Matthew Pfluger
The uninstall code looks like this (simplified):
Function bUninstallAddin(ByVal sAddinName As String, _
ByVal sAddinSourceFilepath As String) As Boolean
' Attempt to close addin in case it is open
On Error Resume Next
' ******************************************
' Code stops after executing the line below
AddIns(sAddinName).Installed = False
On Error GoTo ErrorHandler
' Delete pre-existing registry keys (if any)
If Not bDeleteAddinRegistryKey(sAddinName) Then Err.Raise glHANDLED_ERROR
bUninstallAddin = TRUE
End Function
When the function above closes the target addin, the addin runs an
Auto_Close script to remove commandbars, save settings, and shut down.
However, that code causes code execution to stop, and I want the uninstall
macro to continue.
Here's the Auto_Close routine from the target addin:
Public Sub ShutdownApplication()
On Error Resume Next
Application.ScreenUpdating = False
' This flag prevents this routine from being called a second time
' by Auto_Close if has already been called by another procedure.
gbShutdownInProgress = True
' Do a bunch of things here....
' Continue if not in debug mode.
' ******************************************
' Code stops after executing the line below
If Not gbDEBUG_MODE Then ThisWorkbook.Close False
End Sub
Is there any way to run the shutdown script without terminating code
execution?
Thanks.
Matthew Pfluger