I am using following code to open 2 urls in 2 tabs in first chrome window and 1 url in another chrome window:
- Public Sub ChromeNewWindows()
- Shell ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --new-window -url https://www.facebook.com")
- Shell ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -url https://www.facebook.com")
- Shell ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --new-window -url https://www.google.com")
- End Sub
The Chrome windows open nicely in maximized mode.
However, I need to open both windows in specific window sizes and at specific locations on the screen, say:
.Top = 100, .Left = 100 .Height = 100 .Width = 100 for window 1
.Top = 100, .Left = 300 .Height = 150 .Width = 150 for window 2
I have tried below code to resize and re-position the windows but it doesn't work. It seems that I probably need to open/ change Chrome window state to Normal state and then below code might work
Alternately, I use the below code to first maximize my excel window, get the screen size of the current monitor, change the excel application window state to Normal, and then resize and reposition my excel window based on my screen size. But I am unable to use the With Application command for the chrome window:
Would appreciate if someone could recommend a working solution since my Shell skills are quite rusty.
Note: Sample excel file attached for testing.