Command Button Launches Default Browser Via One Line of VBA Code

Report
Posts
3
Registration date
Saturday July 7, 2018
Status
Member
Last seen
June 2, 2021
-
Posts
2754
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
June 3, 2021
-
I have a userform that allows me to use a webbrowser within it, however sometimes due to compatibility issues I need to use microsoft edge and use it outside of the userform. I had previously fixed the issue however the entire workbook was completely deleted and I forgot to write it down.

I could click on the command button and it would automatically launch edge and navigate to the website I specified. The only thing I can get to work is the web browser within the userform like you typically would:

me.webbrowser1.navigate "google.com"

What's one line of VBA code I could use to launch edge instead? I just can't figure it out again! Thanks for any advice :)

1 reply

Posts
2754
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
June 3, 2021
462
Hi ProWHP,

Here is the requested code line:
Shell ("C:\Program Files\Microsoft Edge\Edge.exe" & " " & "google.com")


Adjust the path to your .exe file for Edge.

Best regards,
Trowa

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!