Code Open Google Chrome Browser Visible = True

Excelpromax123

Board Regular
Joined
Sep 2, 2021
Messages
172
Office Version
  1. 2010
Platform
  1. Windows
Hello everyone GPE! I'm using the following to open Zalo PC to show the window. Currently, I want to change Zalo to Google Chrome.
IE.ShellExecute "chrome:" ' mO chomre but the code does not run. My intention is similar to the code Application.Visible = True to re-display the Excel Interface, but I want to re-display the Google Chomre interface. Please help, thank you very much!

VBA Code:
Sub Openchomre()
    On Error Resume Next
    Dim IE As Object

    Set IE = CreateObject("Shell.Application")
    IE.ShellExecute "zalo:" ' Open Google Chrome
    Set IE = Nothing
                
End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi,

See if this works for you...

Sub OpenChrome()
Dim chromePath As String
Dim url As String

' Path to Google Chrome executable
chromePath = "C:\Program Files\Google\Chrome\Application\chrome.exe"

' URL or website you want to open
url = "Google"

' Use Shell function to open Chrome with the URL
Shell chromePath & " -url " & url, vbNormalFocus
End Sub
 
Upvote 0
Hi,

See if this works for you...

Sub OpenChrome()
Dim chromePath As String
Dim url As String

' Path to Google Chrome executable
chromePath = "C:\Program Files\Google\Chrome\Application\chrome.exe"

' URL or website you want to open
url = "Google"

' Use Shell function to open Chrome with the URL
Shell chromePath & " -url " & url, vbNormalFocus
End Sub
Thank you. Your code opens a new tab. I just want to reopen google chome to turn it back on, not open a new tab
 
Upvote 0
Hi,

try this...

Sub OpenChrome()
Dim chromePath As String
Dim chromeTitle As String
Dim chromePID As Long

' Path to Google Chrome executable
chromePath = "C:\Program Files\Google\Chrome\Application\chrome.exe"

' Title of the Chrome window to look for
chromeTitle = "Google Chrome"

' Try to activate Chrome window if it's already running
On Error Resume Next
AppActivate chromeTitle
chromePID = Err.Number
On Error GoTo 0

' If Chrome is not running, open it
If chromePID <> 0 Then
Shell chromePath, vbNormalFocus
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,109
Members
453,021
Latest member
Justyna P

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