1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| Dim MyAppID As String
Global bEnCours As Boolean
Global HeureProchainAppel
Sub MaProcedure()
If bEnCours = False Then
'Annuler le paramétrage du OnTime programmé précédemment.
On Error Resume Next
Application.OnTime EarliestTime:=HeureProchainAppel, _
Procedure:="MaProcedure", Schedule:=False
Exit Sub
End If
Call Ouvrirnroute
'Prochain appel de OnTime
HeureProchainAppel = Now + TimeValue("00:00:2")
Application.OnTime HeureProchainAppel, "MaProcedure", False
End Sub
Sub Ouvrirnroute()
MyAppID = Shell("C:\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("g3") = Presspp.GetText
Set Pressp = Nothing
Application.ScreenUpdating = True
End Sub |
Partager