Bonsoir,
A partir d'excel j'ouvre un fichier Word, Internet explorer ouvre automatiquement la fenetre de telechargement.(la fenetre standard "Ouvrir, Enregistrer, Annuler" )
J'arrive à extraire le handle de la fenetre et le handle du bouton mais rien ne se passe... Mon bouton Ouvrir n'est pas actionné.
Voici le code :
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByValhwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
Public Declare Function SetActiveWindow Lib "user32.dll" (ByVal hwnd As Long) As Long
Public Const BM_CLICK = &HF5
Sub ApplicationPremierPlan()
Dim hwnd, hwnd_button As Long
hwnd = FindWindow(vbNullString, "Calculatrice" ) '"Téléchargement de fichiers" )
MsgBox hwnd
If hwnd > 0 Then
hwnd_button = FindWindowEx(hwnd, 0, "Button", "Ou&vrir" )
SendMessage hwnd_button, BM_CLICK, 0, 0
End If
End Sub
Merci de votre aide à tous.