简体   繁体   中英

Excel VBA to open website in new tabs in firefox/chrome

I am using the SHELL function to open websites. The wed addresses are listed in column A. My code is working, but the websites open as new windows in chrome and firefox. How do code to make the websites open in tabs?

Update-- below is the simple code. It works for Chrome but not in firefox

Sub firefoxtabs()

Dim Website As String
Dim exepath As String
Dim i As Integer

'exepath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -url "  'open in chrome
exepath = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"  'open in firefox

For i = 1 To 3
    Website = Cells(i, 1).Value
    'Shell (exepath & Website)  'for chorme
    Shell (exepath & " -new-tab " & Website)  'for firefox
Next

End Sub

For Firefox, try this: firefox -new-tab $url .

For Chrome it should be okay with just: chrome $url .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM