'FORCE L'UTILISATEUR A ENREGISTRER EN .xlsm AVEC LES MACROS
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
'On Error GoTo Fin ' Si fenêtre de débogage
Dim xFileName As String
If SaveAsUI <> False Then
Cancel = True
xFileName = Application.GetSaveAsFilename(, "Excel Macro-Enabled Workbook (*.xlsm), *.xlsm", , "Save As xlsm file") 'Peut-on mettre "Excel Macros activées(*.xlsm), *.xlsm" ?
Application.DisplayAlerts = False
If xFileName <> "False" Then
Application.EnableEvents = False
ActiveWorkbook.SaveAs Filename:=xFileName, FileFormat:=xlOpenXMLWorkbookMacroEnabled
Application.EnableEvents = True
'Else
'MsgBox "Action annulée" ' Il n'y a pas besoin de message
Cancel = True
End If
End If
'Fin: ' Fin de débogage
End Sub