Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 215
Default Arranging 3 windows ... Regardless of Monitor Size

Hello;

I've an Excel file (A.xls) that opens (via a VB macro) 2 other Excel files
(B.xls and C.xls), and arranges the 3 windows horizontally (on a 17" laptop
screen) as follows (arrived at by trial & error, and it works fine):

Sub OpenArrange_1()
.................................................. ........................
' for A.xls, full width of screen
................................................
With ActiveWindow
.Width = 1074.74
.Height = 326.25
End With

................................................
' for B.xls, bottom left of screen
................................................
With ActiveWindow
.Top = 328
.Left = 1
.Width = 534
.Height = 332.25
End With

................................................
' for C.xls, bottom right of screen
................................................
With ActiveWindow
.Top = 328
.Left = 534.5
.Width = 543.83
.Height = 332.25
End With
.................................................. .........................

How can I have the same above arrangement (proportionally) on different size
monitors without having different versions of the above code for each monitor
??

Thank you kindly.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 215
Default Arranging 3 windows ... Regardless of Monitor Size

Please disregard the word "horizontally" in my original post. My apologies!

"monir" wrote:

Hello;

I've an Excel file (A.xls) that opens (via a VB macro) 2 other Excel files
(B.xls and C.xls), and arranges the 3 windows horizontally (on a 17" laptop
screen) as follows (arrived at by trial & error, and it works fine):

Sub OpenArrange_1()
.................................................. .......................
' for A.xls, full width of screen
...............................................
With ActiveWindow
.Width = 1074.74
.Height = 326.25
End With

...............................................
' for B.xls, bottom left of screen
...............................................
With ActiveWindow
.Top = 328
.Left = 1
.Width = 534
.Height = 332.25
End With

...............................................
' for C.xls, bottom right of screen
...............................................
With ActiveWindow
.Top = 328
.Left = 534.5
.Width = 543.83
.Height = 332.25
End With
.................................................. ........................

How can I have the same above arrangement (proportionally) on different size
monitors without having different versions of the above code for each monitor
??

Thank you kindly.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Arranging 3 windows ... Regardless of Monitor Size

This worked ok for me:

Option Explicit
Sub testme()

Dim myWindow1 As Window
Dim myWindow2 As Window
Dim myWindow3 As Window

Dim myWidth As Double
Dim myHeight As Double
Dim myTop As Double
Dim myLeft As Double

Set myWindow1 = Workbooks("book1.xls").Windows(1)
Set myWindow2 = Workbooks("book2.xls").Windows(1)
Set myWindow3 = Workbooks("book3.xls").Windows(1)

With Application
myWidth = .UsableWidth
myHeight = .UsableHeight
myTop = 1
myLeft = 1
End With

ActiveWindow.WindowState = xlNormal

With myWindow1
.Height = myHeight / 2
.Top = myTop
.Width = myWidth
.Left = myLeft
End With
With myWindow2
.Height = myHeight / 2
.Top = myTop + .Height
.Width = myWidth / 2
.Left = myLeft
End With
With myWindow3
.Height = myHeight / 2
.Top = myTop + .Height
.Width = myWidth / 2
.Left = myLeft + .Width
End With

End Sub

monir wrote:

Hello;

I've an Excel file (A.xls) that opens (via a VB macro) 2 other Excel files
(B.xls and C.xls), and arranges the 3 windows horizontally (on a 17" laptop
screen) as follows (arrived at by trial & error, and it works fine):

Sub OpenArrange_1()
.................................................. .......................
' for A.xls, full width of screen
...............................................
With ActiveWindow
.Width = 1074.74
.Height = 326.25
End With

...............................................
' for B.xls, bottom left of screen
...............................................
With ActiveWindow
.Top = 328
.Left = 1
.Width = 534
.Height = 332.25
End With

...............................................
' for C.xls, bottom right of screen
...............................................
With ActiveWindow
.Top = 328
.Left = 534.5
.Width = 543.83
.Height = 332.25
End With
.................................................. ........................

How can I have the same above arrangement (proportionally) on different size
monitors without having different versions of the above code for each monitor
??

Thank you kindly.


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 215
Default Arranging 3 windows ... Regardless of Monitor Size

Dave;

Thank you very much. I'll shortly test your "elegant" code.

Meanwhile, you may like to review my "simple" code I posted last night at
MrExcel for the same thread. Any comments ? (apart from lack of elegance!).

Thanks again for your help.



"Dave Peterson" wrote:

This worked ok for me:

Option Explicit
Sub testme()

Dim myWindow1 As Window
Dim myWindow2 As Window
Dim myWindow3 As Window

Dim myWidth As Double
Dim myHeight As Double
Dim myTop As Double
Dim myLeft As Double

Set myWindow1 = Workbooks("book1.xls").Windows(1)
Set myWindow2 = Workbooks("book2.xls").Windows(1)
Set myWindow3 = Workbooks("book3.xls").Windows(1)

With Application
myWidth = .UsableWidth
myHeight = .UsableHeight
myTop = 1
myLeft = 1
End With

ActiveWindow.WindowState = xlNormal

With myWindow1
.Height = myHeight / 2
.Top = myTop
.Width = myWidth
.Left = myLeft
End With
With myWindow2
.Height = myHeight / 2
.Top = myTop + .Height
.Width = myWidth / 2
.Left = myLeft
End With
With myWindow3
.Height = myHeight / 2
.Top = myTop + .Height
.Width = myWidth / 2
.Left = myLeft + .Width
End With

End Sub

monir wrote:

Hello;

I've an Excel file (A.xls) that opens (via a VB macro) 2 other Excel files
(B.xls and C.xls), and arranges the 3 windows horizontally (on a 17" laptop
screen) as follows (arrived at by trial & error, and it works fine):

Sub OpenArrange_1()
.................................................. .......................
' for A.xls, full width of screen
...............................................
With ActiveWindow
.Width = 1074.74
.Height = 326.25
End With

...............................................
' for B.xls, bottom left of screen
...............................................
With ActiveWindow
.Top = 328
.Left = 1
.Width = 534
.Height = 332.25
End With

...............................................
' for C.xls, bottom right of screen
...............................................
With ActiveWindow
.Top = 328
.Left = 534.5
.Width = 543.83
.Height = 332.25
End With
.................................................. ........................

How can I have the same above arrangement (proportionally) on different size
monitors without having different versions of the above code for each monitor
??

Thank you kindly.


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Arranging 3 windows ... Regardless of Monitor Size

I don't visit MrExcel.

monir wrote:

Dave;

Thank you very much. I'll shortly test your "elegant" code.

Meanwhile, you may like to review my "simple" code I posted last night at
MrExcel for the same thread. Any comments ? (apart from lack of elegance!).

Thanks again for your help.



"Dave Peterson" wrote:

This worked ok for me:

Option Explicit
Sub testme()

Dim myWindow1 As Window
Dim myWindow2 As Window
Dim myWindow3 As Window

Dim myWidth As Double
Dim myHeight As Double
Dim myTop As Double
Dim myLeft As Double

Set myWindow1 = Workbooks("book1.xls").Windows(1)
Set myWindow2 = Workbooks("book2.xls").Windows(1)
Set myWindow3 = Workbooks("book3.xls").Windows(1)

With Application
myWidth = .UsableWidth
myHeight = .UsableHeight
myTop = 1
myLeft = 1
End With

ActiveWindow.WindowState = xlNormal

With myWindow1
.Height = myHeight / 2
.Top = myTop
.Width = myWidth
.Left = myLeft
End With
With myWindow2
.Height = myHeight / 2
.Top = myTop + .Height
.Width = myWidth / 2
.Left = myLeft
End With
With myWindow3
.Height = myHeight / 2
.Top = myTop + .Height
.Width = myWidth / 2
.Left = myLeft + .Width
End With

End Sub

monir wrote:

Hello;

I've an Excel file (A.xls) that opens (via a VB macro) 2 other Excel files
(B.xls and C.xls), and arranges the 3 windows horizontally (on a 17" laptop
screen) as follows (arrived at by trial & error, and it works fine):

Sub OpenArrange_1()
.................................................. .......................
' for A.xls, full width of screen
...............................................
With ActiveWindow
.Width = 1074.74
.Height = 326.25
End With

...............................................
' for B.xls, bottom left of screen
...............................................
With ActiveWindow
.Top = 328
.Left = 1
.Width = 534
.Height = 332.25
End With

...............................................
' for C.xls, bottom right of screen
...............................................
With ActiveWindow
.Top = 328
.Left = 534.5
.Width = 543.83
.Height = 332.25
End With
.................................................. ........................

How can I have the same above arrangement (proportionally) on different size
monitors without having different versions of the above code for each monitor
??

Thank you kindly.


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set up a page to display full screen on any size monitor davey139 Excel Discussion (Misc queries) 1 May 24th 09 08:12 AM
open separate Excel windows in dual monitor environment dzili Setting up and Configuration of Excel 2 October 10th 07 02:05 AM
Arranging the VBA console windows Dallman Ross Excel Discussion (Misc queries) 2 October 26th 06 04:42 PM
Arranging Windows J Streger Excel Programming 2 March 31st 05 02:07 AM
arranging charts and visible screen size ThatFella[_4_] Excel Programming 1 September 8th 03 11:57 PM


All times are GMT +1. The time now is 04:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"