Automatic window sizing

wmtsub

Active Member
Joined
Jun 20, 2018
Messages
322
Is there any way to stop excel from opening subsequent workbooks at the size and or location of the last opened workbook?
I wrote a script to open a specific set of data at a specific location and size. I keep this open all day but every time I open anew workbook it snaps to that size/ location. Very annoying.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Where workbookA is the workbook which is opened in the specific location and with a smaller size ...

Untested, but you could try

- create a sub in workbookA to re-set the location and size to normal
- call it from "workbook deactivate" ( in workbookA )
- also call the same code from "workbook before close" ( in workbookA )

You may also need a sub in workbookA to set it to its peculiar settings and call that sub from "workbook activate"
 
Last edited:
Upvote 0
So here is the code I have so far. If i open the wb "WAL Lat Lon 5-1.xlsm" by itself or with other prior existing open wb's this will display properly in the location at the size i want.
But if i open another wb it not open to the new location size. Any Idea why?


Code:
[LEFT][COLOR=#222222][FONT=Verdana]Private Sub Workbook_Open()[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]twn = ThisWorkbook.Name[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]If twn <> "WAL Lat Lon  5-1.xlsm" Then GoTo xit[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]'Minimial View[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.ThisWorkbook.Saved = True[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.DisplayFormulaBar = False[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    ActiveWindow.DisplayWorkbookTabs = False[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    ActiveWindow.DisplayHeadings = False[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.DisplayStatusBar = False[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    ActiveWindow.DisplayHorizontalScrollBar = False[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    ActiveWindow.DisplayVerticalScrollBar = False[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.Top = 4[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.Left = -1437[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.Width = 883[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.Height = 63[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    GoTo ends[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]xit:[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana] ' Regular View[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.ThisWorkbook.Saved = True[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.DisplayFormulaBar = True[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    ActiveWindow.DisplayWorkbookTabs = True[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    ActiveWindow.DisplayHeadings = True[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.DisplayStatusBar = True[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    ActiveWindow.DisplayHorizontalScrollBar = True[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    ActiveWindow.DisplayVerticalScrollBar = True[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.Top = 70[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.Width = 800[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    Application.Height = 500[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]ends:[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]End Sub[/FONT][/COLOR][/LEFT]
 
Upvote 0

Forum statistics

Threads
1,223,754
Messages
6,174,315
Members
452,555
Latest member
colc007

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