Results 1 to 3 of 3

Thread: Automatic window sizing
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Jun 2018
    Posts
    322
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Automatic window sizing

    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.

  2. #2
    Board Regular
    Join Date
    Mar 2015
    Posts
    3,901
    Post Thanks / Like
    Mentioned
    72 Post(s)
    Tagged
    7 Thread(s)

    Default Re: Automatic window sizing

    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 by Yongle; Aug 25th, 2019 at 09:16 AM.

  3. #3
    Board Regular
    Join Date
    Jun 2018
    Posts
    322
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Automatic window sizing

    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:
    Private Sub Workbook_Open() twn = ThisWorkbook.Name If twn <> "WAL Lat Lon 5-1.xlsm" Then GoTo xit 'Minimial View Application.ThisWorkbook.Saved = True Application.DisplayFormulaBar = False ActiveWindow.DisplayWorkbookTabs = False ActiveWindow.DisplayHeadings = False Application.DisplayStatusBar = False ActiveWindow.DisplayHorizontalScrollBar = False ActiveWindow.DisplayVerticalScrollBar = False Application.Top = 4 Application.Left = -1437 Application.Width = 883 Application.Height = 63 GoTo ends xit: ' Regular View Application.ThisWorkbook.Saved = True Application.DisplayFormulaBar = True ActiveWindow.DisplayWorkbookTabs = True ActiveWindow.DisplayHeadings = True Application.DisplayStatusBar = True ActiveWindow.DisplayHorizontalScrollBar = True ActiveWindow.DisplayVerticalScrollBar = True Application.Top = 70 Application.Width = 800 Application.Height = 500 ends: End Sub

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •