我想使用 vba
Internet Explorer 在多个页面上选择选项,我可以使用 vba 打开多个选项卡和多个链接,但只能在第一页上导航。请检查下面给出的编码供您参考:-
Sub mmtlink2()
Dim IE As New SHDocVw.InternetExplorer
Dim st As String
Dim htmldoc As MSHTML.HTMLDocument
Dim i As Long, d As Long, b As Long
'Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
d = 2
For i = 1 To d
If i = 1 Then
IE.navigate "https://www.makemytrip.com/air/search?tripType=O&itinerary=BOM-DXB-D-02Dec2017&paxType=A-1&cabinClass=E"
Else
IE.Navigate2 "https://www.makemytrip.com/air/search?tripType=O&itinerary=BOM-DXB-D-03Dec2017&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
Next i
End Sub
请提供任何解决方案以在第二页上导航。
更正 Else 语句中的语法:
Else
IE.Navigate url, 2048
而不是
Else
IE.Navigate2 url, 2048