Hi Loomah,
Your idea is great!
Thank you
Vlad
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error GoTo Exit_Err
Dim intResp As Integer
ThisWorkbook.Saved = True
'I assume the file is read-only, which is in my case
intResp = MsgBox("This workbook is read only. " & _
"Would you like to save a copy?", vbQuestion + vbYesNoCancel)
If intResp = vbYes Then
Application.Dialogs(xlDialogSaveAs).Show
End If
Cancel = (intResp = vbCancel)
If Not Cancel Then
'Do my cleaning
End If
Exit Sub
Exit_Err:
MsgBox "Error " & Err.Number & " occured in Workbook_BeforeClose." & vbCr & Err.Description, vbCritical, ActiveWorkbook.Name
End Sub