Consulting

Results 1 to 12 of 12

Thread: placing different windows on my screen

  1. #1

    Question placing different windows on my screen

    Since the update from excel 2016 to version 17.07 I have trouble placing different windows on my screen,

    In
    the old version, it is possible to program the location and size of each window in VBA,
    Each window gets a unique name, in the example test.xlsm: 1, test.xlsm: 2 and can be called and programmed in VBA.

    Examp.

    Sub Macro2()
    'Macro2 Macro
    ActiveWindow.NewWindow
    ActiveWindow.NewWindow
    Windows("test.xlsm:1").Activate
    Windows("test.xlsm:2").Activate
    Application.Left =451.75
    Application.Top =4
    Windows("test.xlsm:1").Activate
    End Sub

    n the new version all the windows have the same naam,
    in the example test.xlsm



    Sub Macro1()

    '

    ' Macro1 Macro

    '



    '

    ActiveWindow.NewWindow

    ActiveWindow.NewWindow

    Windows("test.xlsm").Activate

    Windows("test.xlsm").Activate

    Application.Left= 451.75

    Application.Top =4

    Windows("test.xlsm").Activate

    End Sub
    I can no longer find the possibility to program the windows
    My solution now, I have downgraded back to version 16.06 as it is still available by MS. The problem is that I can not upgrade to the latest versions
    Someone has the same problem and / or does anyone have a solution?




  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Back to basics: From Excel 2002
    Arrange Method

    Arranges the windows on the screen. Varint. expression.Arrange(ArrangeStyle, ActiveWorkbook, SyncHorizontal, SyncVertical)

    expression Required. An expression that returns one of the objects in the Applies To list


    ArrangeStyle Optional XlArrangeStyle.


    XlArrangeStyle can be one of these XlArrangeStyle constants.
    xlArrangeStyleCascade. Windows are cascaded.
    xlArrangeStyleTiled default.Windows are tiled
    xlArrangeStyleHorizontal.Windows are arranged horizontally.
    xlArrangeStyleVertical. Windows are arranged vertically.


    ActiveWorkbook Optional Variant. True to arrange only the visible windows of the active workbook. False to arrange all windows. The default value is False.
    SyncHorizontal Optional Variant. Ignored if ActiveWorkbook is False or omitted. True to synchronize the windows of the active workbook when scrolling horizontally. False to not synchronize the windows. The default value is False.
    SyncVertical Optional Variant. Ignored if ActiveWorkbook is False or omitted. True to synchronize the windows of the active workbook when scrolling vertically. False to not synchronize the windows. The default value is False.


    ActiveWindow.NewWindow
    NewWindow is a copy of the active window. You made two copies

    Windows("test.xlsm")

    Test.xlsm is not the copy
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    indeed back to the basic, read the message, it's just an example.
    Of course I use the windows to open different tabs
    The problem is that the windows in the latest Excel update do not have their own name but all the same
    sometimes i use three windows of different sizes, and so far all of them could be programmed in the VBA, but after the update it gives error messages because the names of the windows are no longer recognized

    Here's part of the VBA code that I use
    SubDeelnemers()
    Application.ScreenUpdating= False
    Windows(ThisWorkbook.Name& ":2").Activate
    Sheets("Pilotenlijst").Visible= True
    Sheets("pilotenlijst").Activate
    WithActiveWindow
    .WindowState= xlNormal
    .Top = 1
    .Left = 1
    .Zoom = 120
    .Top = 2.5
    .Left =439.75
    .Width = 610
    .Height =550
    End With
    Application.DisplayFormulaBar= False
    ActiveWindow.DisplayHeadings= False
    Rows("2:300").SortKey1:=Range("B1"), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1,MatchCase:=False, Orientation:=xlTopToBottom
    Windows(ThisWorkbook.Name& ":1").Activate
    Sheets("piloten").Activate
    Sheets("Piloten").Visible= True
    ActiveSheet.Unprotect
    Rows("15:114").EntireRow.Hidden= False
    WithActiveWindow
    .WindowState= xlNormal
    .Top = 1
    .Left = 1
    .Zoom = 100
    .Top = 2.5
    .Left = 1
    .Width =435.75
    .Height =550
    End With

    Last edited by Harrydlk; 10-30-2017 at 12:26 PM.

  4. #4
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Try this
    Sub Deelnemers()
    Application.ScreenUpdating= False
    
    ''Windows(ThisWorkbook.Name & ":1").Activate
    
    
    Sheets("Pilotenlijst").Visible= True
    Sheets("pilotenlijst").Activate
    WithActiveWindow
    .WindowState= xlNormal
    .Top = 1
    .Left = 1
    .Zoom = 120
    .Top = 2.5
    .Left = '''''''''
    '
    '
    'Windows(ThisWorkbook.Name & ":2").Activate
    
    '
    End sub
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  5. #5
    And what's the solution to get a second and third window with other tabs on the screen

  6. #6
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Repeat the above snippet.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  7. #7
    Thank you,
    I begin to understand
    I have to close all windows except 1, and then create new windows every time, and not call the windows again as before.

    Just another way, but works.
    Thanks again for the help

  8. #8
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    I would think you could
       Sheets("Pilotenlijst").Visible= True 
        Sheets("pilotenlijst").Activate 
        WithActiveWindow 
        .WindowState= xlNormal 
        .Top = 1 
        .Left = 1 
        .Zoom = 120 
        .Top = 2.5 
        .Left = '''''''''
    
       Sheets("Sheet2").Visible= True 
        Sheets("Sheet2").Activate 
        WithActiveWindow 
        .WindowState= xlNormal 
        .Top = ?
        .Left = ?
        .Zoom = ? 
        .Top = ?
        .Left = ?
    
       Sheets("Sheet3").Visible= True 
        Sheets("Sheet3").Activate 
        WithActiveWindow 
        .WindowState= xlNormal 
        .Top = ?
        .Left = ? 
        .Zoom = ?
        .Top = ?
        .Left = ?
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  9. #9

    Sorry, your code does not work, I've made it this way

    Sub test()

    Dim wndw AsWindow
    WithActiveWorkbook
    Do Until.Windows.Count = 1
    ActiveWindow.Close
    Loop
    End With

    Sheets("Sheet1").Visible= True
    Sheets("Sheet1").Activate
    WithActiveWindow
    .WindowState= xlNormal
    .Top = 1
    .Left = 1
    .Zoom = 120
    .Top = 2.5
    .Left = 0
    .Width = 236
    .Height =550
    End With


    ActiveWindow.NewWindow
    Sheets("Sheet2").Visible= True
    Sheets("Sheet2").Activate
    WithActiveWindow
    .WindowState= xlNormal
    .Top = 1
    .Left = 1
    .Zoom = 100
    .Top = 2.5
    .Left = 237
    .Width = 315
    .Height =550
    End With


    ActiveWindow.NewWindow
    Sheets("Sheet3").Visible= True
    Sheets("Sheet3").Activate
    WithActiveWindow
    .WindowState= xlNormal
    .Top = 1
    .Left = 1
    .Zoom = 100
    .Top = 1
    .Left = 551
    .Width = 465
    .Height =550
    End With
    End Sub

  10. #10
    Was too optimistic, no longer works after excel 17.xx update, what a mess that new update. will only stay with the version 16.xx

  11. #11
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    I am way out of my comfort level with this issue. I'm going to drop out of the discussion. Maybe a real expert will take over.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  12. #12

    Resolved, today new update office 365, ver.17.10
    Now it is possible to program windows again.
    Previously it was with
    Windows (ThisWorkbook.Name & ": 1"). Activate
    Now the code must be in VBA
    Windows (ThisWorkbook.Name & " - 1"). Activate

    To bat, now all my old spreadsheet using this code no longer work, all have to be customized.
    But after more than a month, MS has tacitly solved this bug

Posting Permissions

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