I have a toolbar application that is created using vba, I am using the code below to close the toolbar when the workbook closes.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars("TPWS Fitment").Delete
On Error GoTo 0
End Sub
However if the user decides not to close the workbook and clicks cancel then the toolbar is lost.
To retreive the toolbar either the macro to open the workbook can be run or the file closed then re-opened. Neither of these are desired.
How do keep the toolbar if the user chooses cancel when attempting to close the workbook.
thanks
Arfan
*EDIT* Just solved it, but if there is a better way then ur reponse is appreciated.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Cancel = True Then
Application.CommandBars("TPWS Fitment").Delete
End If
End Sub
Bookmarks