Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
' "gèle" ou autorise le rafraichissement de l'écran
' permet de bloquer l'affichage de boites de dialogue
' indésirables, les mouvements de la souris
' *à manier avec précaution* (plus radical que ScreenUpdating)
' mpep, auteur inconnu
sub bouton_click
' application.screenupdating= false
WindowUpdating (False) 'to freeze the screen
'
windows("xxxxx").activate
sheets(feuill2).activate
' Etc ...
' Fin du code
WindowUpdating (True) 'to unfreeze the screen
End Sub
Sub WindowUpdating(Enabled As Boolean)
' Completely Locks the Whole Application Screen Area,
' including dialogs and the mouse.
Dim Res As Long
If Enabled Then
LockWindowUpdate 0 'Unlock screen area
Else
Res = LockWindowUpdate(GetDesktopWindow) 'Lock at desktop level
End If
End Sub