I need to open two links in same tab in Google chrome browser. Below is the code I have tried, But I'm getting "File not found" error in line Browser = Shell(Chromepath & "-url URL1"). After opening the first URL(a login page) then it should navigates to second URL in same tab.
Sub Defects()
Dim ExtractliveApp As Variant
Dim Browser As Variant
Dim URL As Variant
URL1 = "go/ExtractliveApp"
URL2 = "https://Extract.live.com/SelfServiceExtracts"
Chromepath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
Browser = Shell(Chromepath & "-url URL1")
Browser = Shell(Chromepath & "-url URL2")
End Sub
You have a typo in your code:
Should be
You need a space after the
Chromepath
as otherwise the Shell is looking forchrome.exe-url
which it can't find (hence the error). I also fixed the use of your URL variables as they will need to be outside the quotes so that they are referenced correctly. Leaving them inside will cause them to be treated literally and Chrome will attempt to browse to URL1 rather than your link.