The Wise Owl logo (an owl and the company name)

Our training courses

Other training resources

Our training venues

Why we are different

Details for ashishgarg

ashishgarg has participated in the following threads:

Added by ashishgarg on 15 Nov 2017 at 12:18

Hi Andy, I learnt so much from your vba classes and want to thank you so much for such great videos. I need your help to sove one of the issue is that i am running loop to open multiple pages on  differebt tabs in internet explorer using vba and checking 2 option on website but after i navigate to second page it still again checking the option on first page please check the code given below for your reference.

On my excel sheet  range("A2") = BOMDXB, range("B2") = 1-dec-17, range("C2") = 10-dec17

Sub mmtlink()

Dim IE As New SHDocVw.InternetExplorer
Dim st As String
Dim htmldoc As MSHTML.HTMLDocument
Dim all As MSHTML.IHTMLElementCollection
Dim one As MSHTML.IHTMLElement
Dim i As Long, d As Long, b As Long

Set IE = CreateObject("InternetExplorer.Application")

IE.Visible = True

d = Range("c2") - Range("b2") + 1
For i = 1 To d
st = Application.WorksheetFunction.Text(Range("b2") + i - 1, "ddmmmyyyy")
If i = 1 Then
    IE.navigate "https://www.makemytrip.com/air/search?tripType=O&itinerary=" _
     & Left(Range("A2"), 3) & "-" & Right(Range("A2"), 3) _
     & "-D-" & st & "&paxType=A-1&cabinClass=E"
          
Else
    IE.Navigate2 "https://www.makemytrip.com/air/search?tripType=O&itinerary=" _
     & Left(Range("A2"), 3) & "-" & Right(Range("A2"), 3) _
     & "-D-" & st & "&paxType=A-1&cabinClass=E", 2048
End If
Do While IE.Busy = True Or IE.readyState <> 4
 Loop
    
    Set htmldoc = IE.document
    
    htmldoc.getElementById("Non stop").Click
    Set all = htmldoc.getElementsByClassName("sortbytype")
  st = "from " & Left(Range("A2"), 3) & " (early)"
    For Each one In all
       If one.getAttribute("Innertext") = st Then
            one.Click
            Exit For
       End If
    Next one
        
Next i

End Sub

 

Head office

Kingsmoor House

Railway Street

GLOSSOP

SK13 2AA

London

Landmark Offices

99 Bishopsgate

LONDON

EC2M 3XD

Manchester

Holiday Inn

25 Aytoun Street

MANCHESTER

M1 3AE

© Wise Owl Business Solutions Ltd 2025. All Rights Reserved.

End of small page here
Please be aware that our website uses cookies!
I'm OK with this Tell me more ...