Coller un texte du presse papier vers une application externe avec VBA sur Excel

Fermé
Sormick Messages postés 145 Date d'inscription dimanche 10 novembre 2013 Statut Membre Dernière intervention 8 avril 2024 - Modifié le 10 févr. 2020 à 11:32
yg_be Messages postés 22724 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 25 avril 2024 - 10 févr. 2020 à 11:29
Bonjour,

Je n'arrive pas à coller un texte sur une application externe avec SENDKEYS
Pouvez vous m'aider s'il vous plait car je ne comprends pas.
Voici ci-dessous mon code:
Sub test()
Dim mydata
Dim toto As String
Dim hwnd&, Style&, Title$, i&
hwnd = GetWindow(GetDesktopWindow(), 5)
Do While hwnd
  Title = GetCaption(hwnd)
  If Len(Title) Then
    ' Enum visible windows only
    If GetWindowLong(hwnd, -16) And &H10000000 Then
      If InStr(1, Title, "échantillonnage", 1) Then
      ShowWindow hwnd, SW_SHOWNORMAL
        AppActivate Title
 Application.Wait Now + TimeValue("0:00:01")
Application.SendKeys "^v", True
  SendKeys "{ENTER}", True

  
  Application.Wait Now + TimeValue("0:00:01")
  Dim Num As Boolean
'Récupère l'état des LED's
If (&H1 And GetKeyState(vbKeyNumlock)) <> 1 Then Num = False
If Num = False Then 'test si eteint
SendKeys "{NUMLOCK}" 'remet la led en état activé
End If

        Exit Sub
      End If
    End If
  End If
  hwnd = GetWindow(hwnd, 2)
Loop
End Sub
A voir également:

1 réponse

yg_be Messages postés 22724 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 25 avril 2024 1 476
22 déc. 2019 à 12:51
bonjour, as-tu essayé ceci:
Application.SendKeys "SoRmIcK", True
?
0
yg_be Messages postés 22724 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 25 avril 2024 1 476
10 févr. 2020 à 11:29
as-tu essayé?
0