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

Application.ScreenUpdating = False (ne fonctionne pas)

1 réponse
Avatar
Daniel
Bonjour à tous

J'ai une macro qui en s'exécutant, je voie défiler à l'écran les étapes.

Même avec ou sans ( Application.ScreenUpdating = ) False au début

et True a la fin de la macro, je vois toujours les étapes.

Comment faire pour que la macro s'exécute en arrière-plan?

Merci :-)

Sub Ouvrirnroute()
MyAppID = Shell("C:\Program Files\Garmin\nRoute\nRoute.exe", 1)
SendKeys "{ESC}", True ' Envoie la combinaison escape pour fermé la
fenêtre
SendKeys "{ESC}", True ' Envoie la combinaison escape pour fermé la
fenêtre
Application.ScreenUpdating = False '-----------------------
Application.Wait (Now + TimeValue("00:00:02"))
SendKeys "^w", True ' Envoie la combinaison CTRL+w ouvre une fenêtre
SendKeys "{tab}", True ' Envoie la combinaison CTRL+tab
SendKeys "{tab}", True ' Envoie la combinaison CTRL+tab
SendKeys "^C", True ' Envoie la combinaison CTRL+c copie sur
presse-papier
SendKeys "{ESC}", True ' Envoie la combinaison escape pour fermé la
fenêtre
SendKeys "%{tab}", True 'Envoie la combinaison CTRL+tab
Dim Presspp As New DataObject
Set Pressp = New DataObject
Presspp.GetFromClipboard 'Récupérer le Presse-papier
Range("h15") = Presspp.GetText
Set Pressp = Nothing
Application.ScreenUpdating = True '--------------------
End Sub

1 réponse

Avatar
Laurent Longre
Hello,

A tout hasard, essaie LockWindowUpdate :

Declare Function LockWindowUpdate Lib "User32" (ByVal hWnd As Long) As Long

Declare Function FindWindowA Lib "User32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Sub Test()

' A la place de ScreenUpdating = False
LockWindowUpdate FindWindowA("XLMAIN", Application.Caption)
' blablalba...
' Pour rétablir l'affichage
LockWindowUpdate 0

End Sub

Cordialement,

Laurent

Bonjour à tous

J'ai une macro qui en s'exécutant, je voie défiler à l'écran les étapes.

Même avec ou sans ( Application.ScreenUpdating = ) False au début

et True a la fin de la macro, je vois toujours les étapes.

Comment faire pour que la macro s'exécute en arrière-plan?

Merci :-)

Sub Ouvrirnroute()
MyAppID = Shell("C:Program FilesGarminnRoutenRoute.exe", 1)
SendKeys "{ESC}", True ' Envoie la combinaison escape pour fermé la
fenêtre
SendKeys "{ESC}", True ' Envoie la combinaison escape pour fermé la
fenêtre
Application.ScreenUpdating = False '-----------------------
Application.Wait (Now + TimeValue("00:00:02"))
SendKeys "^w", True ' Envoie la combinaison CTRL+w ouvre une fenêtre
SendKeys "{tab}", True ' Envoie la combinaison CTRL+tab
SendKeys "{tab}", True ' Envoie la combinaison CTRL+tab
SendKeys "^C", True ' Envoie la combinaison CTRL+c copie sur
presse-papier
SendKeys "{ESC}", True ' Envoie la combinaison escape pour fermé la
fenêtre
SendKeys "%{tab}", True 'Envoie la combinaison CTRL+tab
Dim Presspp As New DataObject
Set Pressp = New DataObject
Presspp.GetFromClipboard 'Récupérer le Presse-papier
Range("h15") = Presspp.GetText
Set Pressp = Nothing
Application.ScreenUpdating = True '--------------------
End Sub