Fermer classeur Excel

isa44

XLDnaute Occasionnel
Bonsoir , j'ai trouvé ce code pour fermer un fichier Excel :
Code:
Sub sortir()
    ActiveWorkbook.Save
    With ActiveWindow
    .DisplayHorizontalScrollBar = True
    .DisplayVerticalScrollBar = True
    .DisplayWorkbookTabs = True
    End With
    AfficherBO
    ActiveWorkbook.Close SaveChanges:=False   
    
End Sub

Mais il reste quand même le premier encadrement Excel. Comment tout fermer ?
 

JCGL

XLDnaute Barbatruc
Re : Fermer classeur Excel

Bonjour à tous,

Peux-tu essayer avec :

Code:
Application.Quit
A+ à tous

Édition : Salut Job le prudent :) (If Workbooks.Count = 1 Then Application.Quit Else ActiveWorkbook.Close)
 
Dernière édition:

job75

XLDnaute Barbatruc
Re : Fermer classeur Excel

Bonjour isa44,

Code:
Sub sortir()
    With ActiveWindow
    .DisplayHorizontalScrollBar = True
    .DisplayVerticalScrollBar = True
    .DisplayWorkbookTabs = True
    End With
    AfficherBO
    ActiveWorkbook.Save
    [COLOR="Red"]If Workbooks.Count = 1 Then Application.Quit Else ActiveWorkbook.Close[/COLOR]
End Sub

Edit : salut JC :)

A+
 
Dernière édition:

Discussions similaires