Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Arret inopiné de macro

2 réponses
Avatar
Bastien Ragni
Bonjour à tous,

Depuis que j'ai découvert le forum, j'ouvre mon classeur avec la création
d'une barre d'outil Imprimer selon le module de FredSigonneau (classeur
exemple).
Grace à MichDenis et Clément Marcotte j'ai résolu le problème de la
bibliothèque Extensibility dont l'emplacement diffère entre XL97 et XL2000.
Grace à Starwing j'ai introduit le module suivant:
Function CONCAT(plage As Range)
Application.Volatile
For Each c In plage
x = x & " " & c.Value
Next
CONCAT = Right(x, Len(x) - 1)
End Function

Voici mon nouveau problème.
Avec l'introduction de ce module ma macro Workbook_Open s'arrete en cours
d'execution lorsque le classeur est ouvert par XL97 (aucun problème avec
XL2000).
La page est blanche, et le clic sur un onglet fait apparaitre la feuille
mais sans les instructions demandées plus loin.
Qu'en pensez-vous?
Merci d'avance.

Private Sub Workbook_Open()
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
Application.CommandBars("TBS Cantini").Visible = True
CommandBarImprimer
CreateBarreImprimer
Application.CommandBars("Worksheet Menu Bar").Enabled = False
[l'arrêt inopiné se produit ici: les instructions suivantes ne sont pas
exécutées]
Dim f As Worksheet
For Each f In Sheets
Sheets(f.Name).Activate
ActiveWindow.DisplayHeadings = False
Next
For Each f In Sheets
Sheets(f.Name).Activate
ActiveWindow.DisplayGridlines = False
Next
For Each f In Sheets
Sheets(f.Name).Activate
ActiveWindow.DisplayZeros = False
Next
End Sub

2 réponses

Avatar
JpPradier
Bonsoir Bastien

Je te propose de mettre la boucle sur les feuilles au début pour voir si ça réagit pareil. Au
passage, j'ai réuni tes trois boucles en une.

j-p

Private Sub Workbook_Open()
Application.ScreenUpdating = False
Dim f As Worksheet
For Each f In Sheets
Sheets(f.Name).Activate
ActiveWindow.DisplayHeadings = False
ActiveWindow.DisplayGridlines = False
ActiveWindow.DisplayZeros = False
Next
Application.DisplayFullScreen = True
Application.CommandBars("TBS Cantini").Visible = True
CommandBarImprimer
CreateBarreImprimer
Application.CommandBars("Worksheet Menu Bar").Enabled = False

End Sub
Avatar
Bastien Ragni
Merci JP

J'essaierai ça "au boulot" puisque ça marche chez moi.
C'est à dire la semaine prochaine car je m'absente pour deux jours.
Merci d'avance car j'ai confiance.
"JpPradier" a écrit dans le message
de news: %
Bonsoir Bastien

Je te propose de mettre la boucle sur les feuilles au début pour voir si
ça réagit pareil. Au
passage, j'ai réuni tes trois boucles en une.

j-p

Private Sub Workbook_Open()
Application.ScreenUpdating = False
Dim f As Worksheet
For Each f In Sheets
Sheets(f.Name).Activate
ActiveWindow.DisplayHeadings = False
ActiveWindow.DisplayGridlines = False
ActiveWindow.DisplayZeros = False
Next
Application.DisplayFullScreen = True
Application.CommandBars("TBS Cantini").Visible = True
CommandBarImprimer
CreateBarreImprimer
Application.CommandBars("Worksheet Menu Bar").Enabled = False

End Sub