I am not able to understand what is the problem with following code -
i = 15
While (i < 100)
If i Mod 2 = 0 Then
handle = FindWindow(vbNullString, "My Details - Windows Internet Explorer")
Range("A1").Value = handle
BringWindowToTop handle
Application.Wait DateAdd("s", 1, Now)
Else
handle1 = FindWindow(vbNullString, "Codeomnitrix - Outlook Web App - Mozilla Firefox")
Range("A2").Value = handle1
BringWindowToTop handle1
Application.Wait DateAdd("s", 1, Now)
End If
i = i + 15
Wend
It should switch between both the windows and let them be in focus till 1 second but what actually happens is it just put Firefox on top and then no switching.
Thanks