Below macro when run, opens a new excel window of the same workbook (lets say Book1.xlsm) and is used to set the size and position of both the worksheet windows on the screen.
However, besides setting the size and position of both the windows of the current workbook, I also need to set the size and position of another workbook (lets say Book2.xlsx) with the same macro. Book2.xlsx will be open at the time of running the macro.
Sub win() Dim myWindow1 As Window, myWindow2 As Window Set myWindow1 = ActiveWindow Set myWindow2 = myWindow1.NewWindow With myWindow1 .WindowState = xlNormal .Top = -13 .Left = 0 .Height = Application.UsableHeight * 1.25 .Width = Application.UsableWidth * 0.25 End With With myWindow2 .WindowState = xlNormal .Top = 300 .Left = 0 .Height = Application.UsableHeight * 0.75 .Width = Application.UsableWidth End With End Sub
Can someone please modify this code so as to do this?
1. I know that my requirement can be met by using the Save layout option of Excel, but there are a few reasons why that is working for me.
2. Also, Book2's size and position can also be set by running a similar macro from within that, but I cannot change the file format of the other file from .xlsx to .xlsm.
Sample file attached