I've tried the below code to adjust the screen size of Excel
Sub win()
Dim myWindow1 As Window, myWindow2 As Window
Set myWindow1 = ActiveWindow
Set myWindow2 = myWindow1.NewWindow
With myWindow1
.WindowState = xlNormal
.Top = 0
.Left = 0
.Height = Application.UsableHeight
.Width = Application.UsableWidth * 0.25
End With
With myWindow2
.WindowState = xlNormal
.Top = 0
.Left = (Application.UsableWidth * 0.25) + 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth * 0.75
End With
End Sub
But i want to change the screen size of google chrome. How can i do without opening new Chrome application using shell ? I want to change the screen size of already opened Chrome Application
You can use functions from the User32-library to control external windows. Here is an example for doing so for a Google Chrome "New Tab" window:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Sub SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Sub Resize_Chrome()
Dim ChromeHandle As Long
ChromeHandle = FindWindow(vbNullString, "New Tab - Google Chrome")
SetWindowPos ChromeHandle, -1, 0, 0, 600, 600, &H10
End Sub
This sets the window to the upper left corner (0,0) with a 600 x 600 pixel size (600,600)
For more information on the SetWindowPos function, see https://msdn.microsoft.com/en-us/library/windows/desktop/ms633545%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396