un petit essai
je passe directe par la compression pas pas le menu
lance GO
regarde la fenêtre
je l'ai rallenti avec des sleep pour que tu vois
ensuite va dans vba et debloque les sendkeys de finalisation
Option Explicit
#If VBA7 Then
Private Declare PtrSafe Function SetTimer Lib "user32.dll" (ByVal hwnd As LongPtr, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As LongPtr) As Long
Private Declare PtrSafe Function KillTimer Lib "user32.dll" (ByVal hwnd As LongPtr, ByVal nIDEvent As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#Else
Private Declare Function SetTimer Lib "user32.dll" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As LongPtr) As Long
Private Declare Function KillTimer Lib "user32.dll" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#End If
Dim TimerID&
Sub Go()
TimerID = SetTimer(0, 0, 100, AddressOf CompressImages)
End Sub
Sub CompressImages()
Static x As Long
Dim C As CommandBarControl
If x = 0 Then
x = 1
For Each C In Application.CommandBars("Picture").Controls
If C.ID = 6382 Then C.Execute
Next ' Application.SendKeys "{DOWN}{TAB}{UP}{ENTER}{ENTER}", True
Else
x = 0: KillTimer 0, TimerID
With CreateObject("wscript.shell")
.SendKeys "{TAB}"
Sleep 10
.SendKeys "{UP}"
Sleep 500
.SendKeys "{TAB}"
Sleep 500
.SendKeys "{TAB}"
Sleep 500
.SendKeys "{TAB}"
'finalisation
'.SendKeys "{ENTER}"
' Sleep 1000
' .SendKeys "{ENTER}"
End With
End If
End Sub
voila maintenant quand a savoir si c'est efficace ma fois
en tout cas ca marche les sendkeys sont bien executé fenêtre affichée
@+
patricktoulon