Code opens new window url as opposed new window in new tab

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,233
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I am using this code below which works but need some advice to edit it if i may.

Rich (BB code):
Sub OpenSuzukiEpc()

 
  Dim chromePath As String
 
  chromePath = """C:\Program Files\Google\Chrome\Application\chrome.exe"""
 
  Shell (chromePath & "https://partsouq.com/en/catalog/genuine/locate?c=Suzuki")

End Sub

Currnetly i have Chrome open with 3 tabs.
When i click on the image logo & this code runs i would like it to just open a new tab so i then have 4 tabs in use BUT what happens is a new chrome window open with the url on its own tab
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi - I think you just need to add --URL after the ChromePath and before the URL, so your code could read:

VBA Code:
Sub OpenSuzukiEpc()
    Dim chromePath As String
    chromePath = """C:\Program Files\Google\Chrome\Application\chrome.exe"""
    Shell chromePath & " --url https://partsouq.com/en/catalog/genuine/locate?c=Suzuki"
End Sub

Let me know if that works.
 
Upvote 0
Hi
That does the same as my code in which a new chrome opens with just the 1 new url
 
Upvote 0
Don't know what to tell you - I ran the code three times, and each time it opened in a new tab in an existing instance of Chrome...

1651660821997.png
 
Upvote 0
Hi,

Ive removed some sheets / info so you can try my file.
You will see the S image for which the code is on.
If you need to have it like how you have it on your file then please edit etc & i will use that thanks.

Download it from here please

TEST WORKSHEET
 
Upvote 0
Hi - I downloaded the workbook, and I didn't even need to edit anything. Trying out your original code, it still opens in the same browser for me each time. This suggests to me that perhaps it has something to do with your browser settings? I don't know if this helps at all, or has any effect, but my browser settings in Chrome have it set to continue where I left off. I know this relates to Startup, but it's maybe worth a try?

1651662194801.png
 
Upvote 0
Strange.

Do you use Firefox ?
Just wondering if its the same
 
Upvote 0
Yes. I only recently installed it too. I tried the following code and each time it opened in a new tab in an existing window:

VBA Code:
Sub OpenURL()
    Dim url As String, FFPATH As String
    
    url = "https://partsouq.com/en/catalog/genuine/locate?c=Suzuki"
    
    FFPATH = "C:\Program Files\Mozilla Firefox\firefox.exe"
    Shell FFPATH & " " & url, vbNormalFocus
End Sub
 
Upvote 0
Solution
Hi,
Thanks for your time.
That worked fine so i will use Firefox.

Have a nice day
 
Upvote 0
Thank you. I'm glad that at least something is working for you!
 
Upvote 0

Forum statistics

Threads
1,215,516
Messages
6,125,280
Members
449,220
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top