Hi,
Try this code:
Sub try()
Dim ie, objshl, wnd, shl
Set shl = CreateObject("Shell.Application")
On Error Resume Next
For Each wnd In shl.Windows
If InStr(1, wnd.FullName, "iexplore.exe", vbTextCompare) > 0 Then
Set ie = wnd
ie.Quit
End If
Next
DoEvents
Set ie = CreateObject("InternetExplorer.Application")
i = 1
ie.Visible = True
'ie.FullScreen = True
Do While Not ie.busy
If i = 1 Then
ie.Navigate "https://login.yahoo.com/?.src=ym&.intl=us&.lang=en-US&.done=http://mail.yahoo.com"
Application.Wait (Now + TimeValue("00:05:00")) '' change this as per your requirement
i = i + 1
ElseIf i = 2 Then
ie.Navigate "https://www.google.com.ph/?gws_rd=ssl"
Application.Wait (Now + TimeValue("00:05:00")) '' change this as per your requirement
i = 1
End If
Loop
CreateObject("WScript.Shell").AppActivate ie.Name
Set ie = Nothing
End Sub
Note : If you dont want to continue do while loop for long to can break and come out of it.
Like below:
If i = 2 Then
Exit Do
End If
Put this code inside do while in elseif part.
Regards,
Paresh J
Bookmarks