Workbook_Open() et Workbook_BeforeClose()

  • Initiateur de la discussion Initiateur de la discussion babap1
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

babap1

XLDnaute Occasionnel
Bonjour,

j'essaye d'ouvrir mon tableur en masquant toutes les bars d'outils mais je ne vois plus le haut de la fenêtre avec la croix pour fermer le tableur... ?

Par ailleurs, j'aimerai masquer la permière ligne mais j'ai une erreur : "Unable to set the Hidden property of the Range class" .


Code:
Private Sub Workbook_Open()
    'Masquer la première ligne
    Application.Range("A1").Select
    Application.Selection.EntireRow.Hidden = True
    
    'Masquer les bars de menu
    For Each CommandBar In Application.CommandBars
        CommandBar.Enabled = False
    Next
    
    'Ajuster la fenêtre à la bonne taille
    With ActiveWindow
        .WindowState = xlNormal
        .Top = 1
        .Left = 1
        .Height = Application.UsableHeigh
        .Width = Application.UsableWidth
    End With
    
    Application.DisplayFormulaBar = False
    Application.DisplayStatusBar = False
    
    'Afficher les ScrollBars ***est-ce bien utile ?***
    ActiveWindow.DisplayHorizontalScrollBar = True
    ActiveWindow.DisplayVerticalScrollBar = True
    ActiveWindow.LargeScroll ToRight:=1
    ActiveWindow.LargeScroll ToLeft:=1
    Application.DisplayScrollBars = True
    Application.DisplayFullScreen = True
    
    'Désactivation des racourcis VB_Windows
    Application.OnKey "%{F8}", ""
    Application.OnKey "%{F11}", ""
    
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.DisplayFullScreen = False

    'Réactiver les CommandBars
    For Each CommandBar In Application.CommandBars
        CommandBar.Enabled = True
    Next
    
    Application.DisplayAlerts = False
    Application.DisplayFormulaBar = True

End Sub

Merci d'avance, 🙂
baptiste
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
4
Affichages
1 K
Réponses
2
Affichages
4 K
Retour