'----------------------------------------
Sub RunOpen()
On Error GoTo RaiseErr
Dim fileToOpen
CloseAll
fileToOpen = Application. _
GetOpenFilename("Excel files (*.xls),*.xls,All files (*.*),*.*")
If fileToOpen <> False Then
Application.Workbooks.Open fileToOpen
End If
Exit Sub
RaiseErr:
MsgBox Err.Description, vbCritical, "Error: " & Err.Number
End Sub
'----------------------------------------
Private Sub CloseAll()
Dim wb As Workbook
Dim bSave As Boolean
bSave = (MsgBox("Do you want to save all workbooks?", vbExclamation + vbYesNo, "Close all") = vbYes)
For Each wb In Application.Workbooks
wb.Close bSave
Next
End Sub
'----------------------------------------
Sub Auto_Close()
Application.CommandBars("My Addin").Delete
End Sub
'----------------------------------------