Réactiver menu Excel

ywax

XLDnaute Nouveau
Bonjour à tous,
J'utilise un fichier excel que j'ai créé avec une private sub dans thisworkbook.

Private Sub Workbook_Open()

Application.StatusBar = "Réalisé par MOI Ctrl + Y pour fermer le fichier sans quitter Excel "

With Application
.WindowState = xlNormal
.Width = 740
.Height = 130
.Top = 0
.Left = 0
End With



Dim cmdb As CommandBar
For Each cmdb In Application.CommandBars
cmdb.Enabled = False
Next cmdb
With Application
.DisplayFullScreen = False
.DisplayStatusBar = True
.DisplayFormulaBar = False


End With
With ActiveWindow
.DisplayHeadings = False
End With
End Sub


A l'ouverture j'ai donc mon fichier sans menu.

Pour fermer mon fichier sans enregistrement j'ai la macro suivante:

Sub Active_menu()

Application.StatusBar = "Prêt "
Application.WindowState = xlMaximized
Dim cmdb As CommandBar
For Each cmdb In Application.CommandBars
cmdb.Enabled = True
Next cmdb
With Application
.DisplayFullScreen = False
.DisplayStatusBar = True
.DisplayFormulaBar = True


End With
With ActiveWindow
.DisplayHeadings = True
End With
ThisWorkbook.Saved = True
ActiveWindow.Close
End Sub


Mon problème est que si on clique sur la croix rouge d'excel le menu ne s'active pas même avec une Private Sub Workbook_BeforeClose(Cancel As Boolean) identique à ma macro Active_menu.
L'écran est bien redimensionné et uniquement la barre de formule apparait.
Pourquoi ?
Merci d'avance pour votre aide.
 

Discussions similaires

Réponses
2
Affichages
345

Statistiques des forums

Discussions
311 735
Messages
2 082 023
Membres
101 873
dernier inscrit
excellllll