[VBA EXCEL] Fermer l'application Excel
Bonjour,
Voici mon code:
mon probleme est que j'arrive à fermer tous les classeurs actifs mais excel ne veut pas se fermer.
Ou est mon erreur?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
Sub save_copy(s_directory As String, s_centrefinancier As String, s_time As String)
Dim x As String
Dim y As String
'Suppression des feuilles non nécessaires
Dim s As Object
Application.DisplayAlerts = False
Workbooks("yyyyy.xls").Close
ThisWorkbook.Activate
For Each s In ThisWorkbook.Sheets
x = s.Name
y = InStr(s.Name, "xxxx")
If InStr(s.Name, "xxxx") = 0 And s.Name <> "BExRepositorySheet" Then
s.Delete
End If
Next s
Set s = Nothing
'Sauvegarde du classeur
ThisWorkbook.SaveAs Filename:= _
s_directory & "xxxx_" & s_centrefinancier & "_" & s_time & ".xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ThisWorkbook.Close (False)
Application.Quit
End Sub |