VBA:IE自动化停止,新标签打开

时间:2017-06-22 07:41:40

标签: vba excel-vba internet-explorer access-vba internet-explorer-11

我通过IE自动化点击的链接会打开一个新标签。使用这个新选项卡,如何在不创建新的Internet Explorer对象的情况下控制它?

If Format(IE.Document.getElementById("ctl00_ContentPlaceHolder1_gvExtract").getElementsByTagName("tr")(1).getElementsByTagName("td")(2).innerText, "MM/DD/YYYY HH:MM:SS") = Format(ExtractDate, "MM/DD/YYYY HH:MM:SS") Then 'compair date to see if this is the correct file to download.
    IE.Document.getElementById("ctl00_ContentPlaceHolder1_gvExtract").getElementsByTagName("tr")(1).getElementsByTagName("td")(1).getElementsByTagName("a")(0).Click ' select file to download
Sleep (100)
Progs "Downloading Extract"
'IE.Visible = False
'<a href='javascript:OpenDownloadWindow("../Common/FileDownloader.aspx?fileKey=2945596")'>Work Order Inquiry - Work Order</a>
End If
IEBusy
Do
wHandle = FindWindow(vbNullString, "Internet Explorer")
IEBusy
If wHandle = 0 Then
Else
    IE.Visible = True
    CreateObject("WScript.Shell").AppActivate wHandle
    SendKeys "{TAB}", True
    SendKeys "~", True
    Exit Do
End If
DoEvents
Sleep (100)
Loop

此锚点是<a href='javascript:OpenDownloadWindow("../Common/FileDownloader.aspx?fileKey=2945596")'>Work Order Inquiry - Work Order</a>

上点击的超链接

它会打开一个新选项卡,我似乎没有自动控制权。

0 个答案:

没有答案