VBA - appactivate - not able to send web address to a browser

musicgold

Board Regular
Joined
Jan 9, 2008
Messages
197
Hi,

I am trying to send a web address in the URL box of Chrome using the following code, but it is not working.
The browser is already open showing www.google.com.
Why is it not working?

Thanks

VBA Code:
AppActivate "Google" 
SendKeys "^L", False
SendKeys "www.yahoo.com", True
SendKeys {ENTER}
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
I found this at Excel Academy. It works for me.

VBA Code:
Sub OpenHyperlinkInChrome()

    Dim sChromeFileLocation As String
    
    Dim sHyperlink As String
    
'   URL/hyperlink to open
    sHyperlink = "https://www.mrexcel.com/"
    
'   Default location of Chrome.
    sChromeFileLocation = """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"""
    
    Shell (sChromeFileLocation & "-url " & sHyperlink)

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,588
Messages
6,125,691
Members
449,250
Latest member
azur3

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