Reputation: 118
I am doing some web scraping using excel vba.
At one point in my program my internet explorer instance opens an OpenFileDialog. I need to access this dialog and provide it with a filename. Is there a way to do this in vba?
My idea was to get the window handle (I've already done that) and then somehow get the object using the handle, but i cannot find a way to use the handle to access the window.
Upvotes: 0
Views: 337
Reputation: 15923
if you have the hWind of the dialag box, then the function
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
will allow you to send keys to the application with
Debug.Print PostMessage(hWind, WM_KEYDOWN, vbKeyA, 0)
more info here
Upvotes: 1