与IE标签交互一旦打开
我在这里要做的是在不同的IE选项卡中同时自动打开几个帮助台票据。 我在Excel中创build一个票号列表,然后循环显示票号,打开每个号码。
我的代码似乎工作正常,当我打开每个单独的IE实例,但由于我试图打开它们在一个IE实例的单独的选项卡中,我得到第二个循环的错误。 这是我到目前为止:
Set Tickets = Sheet5.Range("a1", Range("a1").End(xlDown)) Set ie = New InternetExplorerMedium ie.Visible = 1 apiShowWindow ie.hwnd, SW_MAXIMIZE For Each Ticket In Tickets If Ticket <> "" And Not Ticket Like "IM*" And Not Ticket Like "ARS*" And Not Ticket Like "C*" Then 'Load Mantis Page If Tabbed = False Then ie.Navigate "http://URL" Else: ie.Navigate "http://URL", CLng(2048) End If Do DoEvents Loop Until ie.ReadyState = 4 'LoginCheck Set LoginExists = ie.document.getElementById("username") If LoginExists Is Nothing Then GoTo SearchForTicket Else: GoTo Login End If Login: Call ie.document.getElementById("username").SetAttribute("value", "xx") Call ie.document.getElementById("password").SetAttribute("value", "xx") ie.document.getElementById("login_form").Submit Do DoEvents Loop Until ie.ReadyState = 3 GoTo SearchForTicket 'Search for Mantis ticket SearchForTicket: Application.Wait (Now + TimeValue("0:00:03")) ie.document.All("bug_id").Value = Ticket Set AllButtons = ie.document.getElementsByTagName("input") For Each Button In AllButtons If Button.Value = "Jump" Then Button.Click Exit For End If Next End If Tabbed = True Next
它第一次工作,并打开IE,导航到页面,并search票。 第二次,它打开新标签页并导航到页面,但是当它试图search第二张票时,我得到一个错误:
Object doesn't support this property or method"
在线:
ie.document.All("bug_id").Value = Ticket
到目前为止,我一直在寻找一个没有运气的答案。 任何帮助,将不胜感激。