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

Sormick Messages postés 146 Date d'inscription   Statut Membre Dernière intervention   -  
yg_be Messages postés 23541 Date d'inscription   Statut Contributeur Dernière intervention   -
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 23541 Date d'inscription   Statut Contributeur Dernière intervention   Ambassadeur 1 584
 
bonjour, as-tu essayé ceci:
Application.SendKeys "SoRmIcK", True
?
0
yg_be Messages postés 23541 Date d'inscription   Statut Contributeur Dernière intervention   1 584
 
as-tu essayé?
0