MannStewart
New Member
- Joined
- Oct 5, 2019
- Messages
- 14
Hi
I have an existing code as follows that opens a new Firefox browser tab each time it's run, but it ends up opening too many repeated identical tabs on the browser.
I'm thinking it should be modified to just activate the already opened tab if that URL is already open, instead of needlessly opening a new tab of the same site every time. But I don't know how to with my limited VBA knowledge, so hoping if someone could kindly help me to.
This is the tab opener code:
Stewart
I have an existing code as follows that opens a new Firefox browser tab each time it's run, but it ends up opening too many repeated identical tabs on the browser.
I'm thinking it should be modified to just activate the already opened tab if that URL is already open, instead of needlessly opening a new tab of the same site every time. But I don't know how to with my limited VBA knowledge, so hoping if someone could kindly help me to.
VBA Code:
Sub OpenFireFoxNewTab(url As String)
Dim pathFireFox As String
pathFireFox = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
If Dir(pathFireFox) = "" Then
pathFireFox = "C:\Program Files\Mozilla Firefox\firefox.exe"
End If
Shell """" & pathFireFox & """" & " -new-tab " & url, vbHide
End Sub
This is the tab opener code:
VBA Code:
Sub FireFox_TopUniv()
OpenFireFoxNewTab "https://www.topuniversities.com/university-rankings/world-university-rankings/2024"
End Sub
Stewart