1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Sub SelectFileInEdgeDialog()
Dim openDialogHwnd As LongPtr
openDialogHwnd = FindWindow(vbNullString, "Ouvrir")
If openDialogHwnd = 0 Then
MsgBox "La fenêtre 'Ouvrir' n'a pas été trouvée."
Exit Sub
End If
Dim fileListHwnd As LongPtr
fileListHwnd = FindWindowEx(openDialogHwnd, 0, "ComboBoxEx32", vbNullString)
fileListHwnd = FindWindowEx(fileListHwnd, 0, "ComboBox", vbNullString)
If fileListHwnd = 0 Then
MsgBox "La liste des fichiers n'a pas été trouvée."
Exit Sub
End If
Dim fileName As String
fileName = "chemindemonfichier"
SendMessage fileListHwnd, CB_SELECTSTRING, -1, ByVal fileName
Dim openButtonHwnd As LongPtr
openButtonHwnd = FindWindowEx(openDialogHwnd, 0, "Button", "&Ouvrir")
SendMessage openButtonHwnd, BM_CLICK, 0, 0
End Sub |
Partager