PDA

View Full Version : placing different windows on my screen



Harrydlk
10-30-2017, 09:36 AM
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?

SamT
10-30-2017, 12:00 PM
Back to basics: From Excel 2002
Arrange MethodArranges 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 (http://www.vbaexpress.com/forum/).




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

Harrydlk
10-30-2017, 12:15 PM
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

SamT
10-30-2017, 03:37 PM
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

Harrydlk
10-30-2017, 04:02 PM
And what's the solution to get a second and third window with other tabs on the screen

SamT
10-31-2017, 08:45 AM
Repeat the above snippet.

Harrydlk
10-31-2017, 09:21 AM
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

SamT
10-31-2017, 05:31 PM
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 = ?

Harrydlk
11-01-2017, 01:26 AM
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

Harrydlk
11-01-2017, 03:25 AM
:banghead:
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

SamT
11-01-2017, 01:56 PM
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.

Harrydlk
11-03-2017, 04:55 AM
:rofl:

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