如何在Internet Explorer的一个选项卡中打开excel链接

时间:2017-04-11 11:34:53

标签: excel vba excel-vba internet-explorer

运行此宏代码时,它将在不同窗口的Internet Explorer中打开A行的链接。应该编辑什么,以便它只在一个浏览器和一个选项卡中打开。

Sub OpenInAnotherBrowser()
Dim iePath As String
Dim browser As String
Dim URL As String
Dim useIE As Boolean
Dim rowInd As Integer

iePath = "C:\Program Files\Internet Explorer\iexplore.exe"
useIE = True

If Dir(iePath) = "" Then pathie = "C:\Program Files\Internet Explorer\iexplore.exe"


If Dir(iePath) = "" Then
    If MsgBox("IE Not Found, Open with default browser?", vbQuestion + vbYesNo) = vbYes Then
        useIE = False
    End If
End If

rowInd = 1

Do Until IsEmpty(Cells(rowInd, 1)) 'loop mo until empty cell mag point

    URL = Cells(rowInd, 1).Value

    If useIE Then
        Shell """" & iePath & """" & URL, vbHide
    Else
        Application.FollowHyperlink URL
    End If

    rowInd = rowInd + 1 'Iterate here
Loop
End Sub

0 个答案:

没有答案