JBARBE
XLDnaute Barbatruc
Bonjour,
Lors de la fermeture de mon fichier avec le bouton " quitter " la simulation CTRL + F1 ne fonctionne pas bien !!!
Voici mon code : et mon fichier !
MERCI à l'avance !
Lors de la fermeture de mon fichier avec le bouton " quitter " la simulation CTRL + F1 ne fonctionne pas bien !!!
Voici mon code : et mon fichier !
Code:
Option Explicit
Private Declare Sub keybd_event Lib "user32" ( _
ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
Sub Quitter()
Application.ScreenUpdating = False
'Simule Ctrl+F1 (à lancer depuis la feuille de calcul)
Const VK_CONTROL = &H11
Const VK_F1 = &H70
Const KEYEVENTF_KEYUP = &H2
keybd_event VK_CONTROL, 0, 0, 0
keybd_event VK_F1, 0, 0, 0
keybd_event VK_F1, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_CONTROL, 0, KEYEVENTF_KEYUP, 0
ActiveWindow.DisplayHeadings = True
Application.DisplayFormulaBar = True
ActiveWorkbook.Save
Application.Quit
Application.ScreenUpdating = True
End Sub
Sub Auto_Open()
'Simule Ctrl+F1 (à lancer depuis la feuille de calcul)
Const VK_CONTROL = &H11
Const VK_F1 = &H70
Const KEYEVENTF_KEYUP = &H2
keybd_event VK_CONTROL, 0, 0, 0
keybd_event VK_F1, 0, 0, 0
keybd_event VK_F1, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_CONTROL, 0, KEYEVENTF_KEYUP, 0
End Sub
MERCI à l'avance !