JohnPoole
Active Member
- Joined
- Jun 9, 2005
- Messages
- 267
Hi all, I have some VBA which gives me the Window Handle of some Chrome Windows.... That should be all I need to send it a refresh request - handle is stored in variable hWnd - I want to avoid the F5 Sendkeys method as I don't want to lose window focus .. All I'm seeing online after multiple Google searches is to use Selenium, but even this doesn't seem to get around my actual issue of just sending a refresh directly to Chrome... An example of what I have so far:
Is their a better solution? Or will I really need Seleniun to accomplish this?
Thanks in advance,
John
VBA Code:
Private Declare PtrSafe Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long
Public Function Refresh(MyHandle)
Debug.Print "Refreshing " & MyHandle
Dim hWnd As Long
hWnd = MyHandle
If hWnd > 0 Then SetForegroundWindow hWnd '''''''''''''This is the bit I want to replace...
Application.SendKeys ("{F5}") '''''''''''''This is the bit I want to replace...
End Function
Sub Test_Refresh()
Call Refresh(4264404)
End Sub
Is their a better solution? Or will I really need Seleniun to accomplish this?
Thanks in advance,
John