using command button to open chrome,

geno32080

Board Regular
Joined
Jan 23, 2020
Messages
112
Office Version
  1. 2013
Platform
  1. Windows
I had no idea that this would be so complicated, Have read 100's of threads and posts. I have a Userform that I have set up as a "home page" of a workbook. All I wanted to do was to click that google button and open my browser which is chrome, the home page is set to google. How hard should this be? I set this up got it to load when the PC is turned on, so this is my home screen. This is a older laptop running windows 8. Now I find myself in a programming nightmare. Can anyone shed some light as how this is done? Everything works accept the bottom buttons, I know this asking alot, but I feel like this is my last resort, This group always comes up with a clean solution.
Thank you in advance. My vision sometimes out reaches my knowledge of "how to"

1724504896127.png
 

Attachments

  • 1724505470685.png
    1724505470685.png
    4.9 KB · Views: 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Seeing your button click code might have been useful. Try inserting this between the Sub and End Sub lines of your button click procedure.
Note: change the line to your desired url and change the line for your browser file path. Your browser may or may not recognize the /new-window switch, so that may need tweaking. This could be simplified by replacing the variables with fixed values.
VBA Code:
Dim strUrl As String, strBrowserPath As String, strNewWindow As String

strBrowserPath = "C:\Program Files\Mozilla Firefox\Firefox.exe "
strNewWindow = "/new-window "
strUrl = "https://google.ca"
Shell strBrowserPath & strNewWindow & strUrl
 
Upvote 0
This is what I finally came up with, this works, it doesn't open chrome in full screen but it does open the application, any thought on that?

Private Sub CommandButton15_Click()
VBA.Shell "C:\Program Files (x86)\Google\Chrome\Application\Chrome", vbNormalFocus
End Sub

and then I used the same vba shell for outlook, works great, opens in full screen.

Private Sub CommandButton14_Click()
VBA.Shell "C:\Program Files\Microsoft Office 15\root\office15\Outlook", vbNormalFocus
End Sub

Now to get the shut off pc button working,
Thanks for the advice, sometimes all I need is kick and things roll on.
Thank you
 
Upvote 0
it doesn't open chrome in full screen
Why not try the new window switch as I posted? Or did you? For Chrome, it may need to be
--new-window and not /new-window

Not that I like using SendKeys, but if there is a keyboard number for Windows and pgeup (page up) keys then that might work. I presume your Chrome settings are to always open window maximized.

BTW, I hope that if you post a significant number of code lines that you'll use code tags (vba button on posting toolbar) to maintain indentation and readability.
 
Upvote 0
Took about 20 minutes to find a working SendKeys combination to maximize my vbe window, but it is SendKeys("% x")
 
Upvote 0
Its all good now, the reason it was not opening in full screen is because I had the chrome application running already. When I went back to the desk top and closed that browser and rebooted the machine, the google button on the Userform opened chrome with the correct window size. Got the shut down button working also,
I added the workbook saved just in case I make changes and forget to save it when I shut down the PC . Now it will save changes. It only takes once to learn that lesson...

Private Sub CommandButton13_Click()
ThisWorkbook.Save
Application.DisplayAlerts = True
Application.Quit

Shell "Shutdown /l /f"

End Sub

Thanks for chiming in, I may not have used all your ideas, but that got me thinking and on the right track. I appreciate your input.
 
Upvote 0

Forum statistics

Threads
1,223,883
Messages
6,175,167
Members
452,615
Latest member
bogeys2birdies

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