Hello nanard, jean -Marie et le forum,
j'ai posté un jour ceci sur le forum (je n'ai plus l'adresse du lien) :
Cette question revient souvent : comment masquer/afficher les barres (de titre de défilement de menu
etc...) et les onglets.
Attention! Après il faut tout remettre en ordre, sinon c'est le mégabôdel!
Application.CommandBars(1).Enabled = False ' (masquer la barre de menus)
Application.CommandBars(1).Enabled = True '(rétablir)
Plein écran :
Application.WindowState = xlMaximized
Application.DisplayFullScreen = True
Application.DisplayFullScreen = False '(rétablir)
Application.DisplayStatusBar = False' (Barre d'état)
Application.DisplayFormulaBar = False ' (Barre de formules)
Les barres d'outils standard format et dessin
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Drawing").Visible = False
Masquage de toutes les barres d'outils présentes et copier leur nom dans feuil1
For Each Cbar In Application.CommandBars
If Cbar.Type = msoBarTypeNormal Then
If Cbar.Visible Then
TBarCompteur = TBarCompteur + 1
ThisWorkbook.Sheets("Feuil1").Cells(TBarCompteur, 1).Value = Cbar.Name
Cbar.Enabled = True
End If
End If
Next Cbar
'Barres de défilement vertical et horizontal (= ascenseurs)
With ActiveWindow
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = True
End With
'Masquage des onglets
With ActiveWindow
.DisplayWorkbookTabs = False ' onglets
End With
En-têtes de lignes et de colonnes
With ActiveWindow
.DisplayHeadings = False
End With
Avanrt de fermer : tout rétablir
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Application
.CommandBars(1).Enabled = True
.CommandBars(1).Visible = True
.DisplayFullScreen = False
.DisplayStatusBar = True
.DisplayFormulaBar = True
End With
With ActiveWindow
.DisplayHeadings = True
.DisplayWorkbookTabs = True
End With
lign = 1
Tbar = ThisWorkbook.Sheets("Feuil1").Cells(lign, 1)
Do While Tbar <> ""
Application.CommandBars(Tbar).Enabled = True
Application.CommandBars(Tbar).Visible = True
lign = lign + 1
Tbar = ThisWorkbook.Sheets("Feuil1").Cells(lign, 1)
Loop
End Sub
Sub Masquer()
Application.CommandBars(1).Enabled = False
'Application.CommandBars(1).Enabled = True
Application.WindowState = xlMaximized
Application.DisplayFullScreen = True
'Application.DisplayFullScreen = False
Application.DisplayStatusBar = False
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False 'Barre d'état
Application.DisplayStatusBar = True 'Barre d'état
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Drawing").Visible = False
Application.ScreenUpdating = False
ThisWorkbook.Sheets("StockBars").Select
ThisWorkbook.Sheets("StockBars").Range("A:A").ClearContents
TBarCompteur = 0
For Each Cbar In Application.CommandBars
If Cbar.Type = msoBarTypeNormal Then
If Cbar.Visible Then
TBarCompteur = TBarCompteur + 1
ThisWorkbook.Sheets("StockBars").Cells(TBarCompteur, 1).Value = Cbar.Name
Cbar.Enabled = True
End If
End If
Next Cbar
With ActiveWindow
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = True
.DisplayWorkbookTabs = False 'false onglets
End With
ThisWorkbook.Sheets("feuil1").Select
With ActiveWindow
.DisplayHeadings = False
.DisplayWorkbookTabs = False
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
PlaySound ThisWorkbook.Path & "\GDfini", 0, 0
lign = 1
Tbar = ThisWorkbook.Sheets("StockBars").Cells(lign, 1)
Do While Tbar <> ""
Application.CommandBars(Tbar).Enabled = True
Application.CommandBars(Tbar).Visible = True
lign = lign + 1
Tbar = ThisWorkbook.Sheets("StockBars").Cells(lign, 1)
Loop
ThisWorkbook.Saved = True
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
If Application.Workbooks.Count = 1 Then Application.Quit
With Application
.CommandBars(1).Enabled = True
End With
End Sub
Sub Sesame()
ThisWorkbook.Sheets("Feuil1").Select
With Application
.CommandBars(1).Enabled = True
.CommandBars(1).Visible = True
.DisplayFullScreen = False
.DisplayStatusBar = True
.DisplayFormulaBar = True
End With
With ActiveWindow
.DisplayHeadings = True
.DisplayWorkbookTabs = True
End With
lign = 1
Tbar = ThisWorkbook.Sheets("StockBars").Cells(lign, 1)
Do While Tbar <> ""
Application.CommandBars(Tbar).Enabled = True
Application.CommandBars(Tbar).Visible = True
lign = lign + 1
Tbar = ThisWorkbook.Sheets("StockBars").Cells(lign, 1)
Loop
Application.Interactive = True
End Sub
@+
C@thy