encore moi !

voila j'ai 2 soucis que je n'arrive pas à résoudre .

1) j'arrive pas à ré-afficher ma barre des formules en fermant mon fichier, toutes les autres barres sont bien restituée.

2) comment affecter ces masquages de barres uniquement sur mon classeur ?
ex : fichier 1 --> masque les barres
et si Fichier 2 ouvert aussi dans la même instance excel --> barre pas masqué.

en faite peut-on jouer avec le classeur qui a le focus ?

ci dessous mon code pour le point 1

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim cmdB As CommandBar
Dim hwnd As Long
 
' rétablissement du controlebox
 hwnd = FindWindowA(vbNullString, Application.Caption)
 SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) Or &H80000
 
'retablissement des barre de controles
For Each cmdB In Application.CommandBars
cmdB.Enabled = True
Next cmdB
 
'retablissement de la barre formule
Application.DisplayFormulaBar = True
 
'suppression barre perso
CBDeleteCommandBar ("Personnalisé 1")
 
' desactivation du mode plein ecran au cas où...
With Application
.DisplayFullScreen = False
End With
 
End Sub

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
Private Sub Workbook_Open()
Dim cmdB As CommandBar
Dim hwnd As Long
 
'met toutes les feuille visible
For i = 1 To ThisWorkbook.Sheets.Count
ThisWorkbook.Sheets(i).Visible = True
Next i
 
' met la feuille bonjour invisible
ThisWorkbook.Sheets("BONJOUR").Visible = xlVeryHidden
 
' desactive le controle box
 hwnd = FindWindowA(vbNullString, Application.Caption)
 SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) And &HFFF7FFFF
 
' desactive les barre de controle
For Each cmdB In Application.CommandBars
cmdB.Enabled = False
Next cmdB
 
' desactive la barre de formule
Application.DisplayFormulaBar = False
 
' fabrique ma barre perso
menuperso
 
End Sub
merci de votre aide