We can use below code to active, minimize, maximize a browser. I put all these three methods in a single function, but you need to tweek this code as per your needs.
Function WinActivate(Object)
Dim hWnd
hWnd = Object.GetROProperty("hwnd") 'First get the window handle
On Error Resume Next
Window("hwnd:=" & hWnd).Activate 'Put fouse on the window
If Err.Number <> 0 Then
hWnd=Browser("hwnd:=" & hWnd).Object.hWnd 'now get the browser handle
Window("hwnd:=" & hWnd).Activate
'Window("hwnd:=" & hWnd).minimize 'To minimize the browser
'Window("hwnd:=" & hWnd).maximize
Err.Clear
End If
On Error Goto 0
End Function
RegisterUserFunc "Browser","Activate","WinActivate"
RegisterUserFunc "Browser","Minimize","WinMinimize"
RegisterUserFunc "Browser","Maximize","WinMaximize"
Browser(objBrowser).Activate
Browser(objBrowser).Minimize
Browser(objBrowser).Maximize
No comments:
Post a Comment