Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 65
Default How to use CompareSideBySide method?

I've got XL2003. I noticed the "CompareSideBySide" in the Window
menu, and thought I would explore that in VBA. I use two monitors and
spread the Excel application across both, with two workbooks open, one
i each monitor. I was hoping a simple macro could resize everything
and place the two workbooks, rather than having to resize everything
manually.

But I can't find much on the CompareSideBySide method. Everything
I've seen specifies only one workbook name. My Personal.xls always
opens with any other workbook because I have macros. I wonder if I
can specify the windows to resize and compare so Excel doesn't grab
the Personal window just because it's open.

If anyone has any insight or examples on using this, I would
appreciate the info. Thank you.
Ed

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How to use CompareSideBySide method?

Ed,
I don't have XL2003, so I can't say about CompareSideBySide. However, I use
this from a menu item to resize all windows based on the the size of the
active window.
Amend to your needs.

Private Type Rect
rLeft As Single
rTop As Single
rWidth As Single
rHeight As Single
End Type

Public Function CustomArrangeWindows()
Dim Wnd As Window
Dim NonActRect As Rect

Const MINIMUM_HEIGHT As Long = 30
Const MINIMUM_WIDTH As Long = 50

If ActiveWindow.WindowState < xlNormal Then
MsgBox "Cannot perform custom arrangement when the active window is
minimised or maximised."
Exit Function
End If

With NonActRect
If ResizeActiveWindow() = True Then
'Arrange horizontally, below the ActiveWindow
.rLeft = 0

.rTop = ActiveWindow.Height

.rWidth = Application.UsableWidth
'To avoid error trying to set the window too small
If .rWidth < MINIMUM_WIDTH Then .rWidth = MINIMUM_WIDTH

.rHeight = Application.UsableHeight - .rTop
'To avoid error trying to set the window too small
If .rHeight < MINIMUM_HEIGHT Then .rHeight = MINIMUM_HEIGHT
Else
'Arrange vetically, to the right of the ActiveWindow
.rLeft = ActiveWindow.Width

.rTop = 0

.rWidth = Application.UsableWidth - .rLeft
'To avoid error trying to set the window too small
If .rWidth < MINIMUM_WIDTH Then .rWidth = MINIMUM_WIDTH

.rHeight = Application.UsableHeight
'To avoid error trying to set the window too small
If .rHeight < MINIMUM_HEIGHT Then .rHeight = MINIMUM_HEIGHT
End If

For Each Wnd In Windows
If (Wnd.Caption < ActiveWindow.Caption) And (Wnd.Visible = True)
Then
Wnd.Left = .rLeft
Wnd.Top = .rTop
Wnd.Width = .rWidth
Wnd.Height = .rHeight
End If
Next
End With

End Function

'Helper routine for CustomArrangeWindows
Private Function ResizeActiveWindow() As Boolean
Dim StretchWidth As Boolean

With ActiveWindow
.Left = 0
.Top = 0
'see if we should stretch the .Width or the .Height
If .Width .Height Then
StretchWidth = True
.Width = Application.UsableWidth
Else
StretchWidth = False
.Height = Application.UsableHeight
End If
End With

ResizeActiveWindow = StretchWidth

End Function

NickHK

"Ed" wrote in message
oups.com...
I've got XL2003. I noticed the "CompareSideBySide" in the Window
menu, and thought I would explore that in VBA. I use two monitors and
spread the Excel application across both, with two workbooks open, one
i each monitor. I was hoping a simple macro could resize everything
and place the two workbooks, rather than having to resize everything
manually.

But I can't find much on the CompareSideBySide method. Everything
I've seen specifies only one workbook name. My Personal.xls always
opens with any other workbook because I have macros. I wonder if I
can specify the windows to resize and compare so Excel doesn't grab
the Personal window just because it's open.

If anyone has any insight or examples on using this, I would
appreciate the info. Thank you.
Ed



  #3   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 65
Default How to use CompareSideBySide method?

Wow, Nick. Thanks for sharing that. I'll have to play with it to see
what happens when I'm stretched across two monitors.

Ed

On Apr 19, 10:16 pm, "NickHK" wrote:
Ed,
I don't have XL2003, so I can't say about CompareSideBySide. However, I use
this from a menu item to resize all windows based on the the size of the
active window.
Amend to your needs.

Private Type Rect
rLeft As Single
rTop As Single
rWidth As Single
rHeight As Single
End Type

Public Function CustomArrangeWindows()
Dim Wnd As Window
Dim NonActRect As Rect

Const MINIMUM_HEIGHT As Long = 30
Const MINIMUM_WIDTH As Long = 50

If ActiveWindow.WindowState < xlNormal Then
MsgBox "Cannot perform custom arrangement when the active window is
minimised or maximised."
Exit Function
End If

With NonActRect
If ResizeActiveWindow() = True Then
'Arrange horizontally, below the ActiveWindow
.rLeft = 0

.rTop = ActiveWindow.Height

.rWidth = Application.UsableWidth
'To avoid error trying to set the window too small
If .rWidth < MINIMUM_WIDTH Then .rWidth = MINIMUM_WIDTH

.rHeight = Application.UsableHeight - .rTop
'To avoid error trying to set the window too small
If .rHeight < MINIMUM_HEIGHT Then .rHeight = MINIMUM_HEIGHT
Else
'Arrange vetically, to the right of the ActiveWindow
.rLeft = ActiveWindow.Width

.rTop = 0

.rWidth = Application.UsableWidth - .rLeft
'To avoid error trying to set the window too small
If .rWidth < MINIMUM_WIDTH Then .rWidth = MINIMUM_WIDTH

.rHeight = Application.UsableHeight
'To avoid error trying to set the window too small
If .rHeight < MINIMUM_HEIGHT Then .rHeight = MINIMUM_HEIGHT
End If

For Each Wnd In Windows
If (Wnd.Caption < ActiveWindow.Caption) And (Wnd.Visible = True)
Then
Wnd.Left = .rLeft
Wnd.Top = .rTop
Wnd.Width = .rWidth
Wnd.Height = .rHeight
End If
Next
End With

End Function

'Helper routine for CustomArrangeWindows
Private Function ResizeActiveWindow() As Boolean
Dim StretchWidth As Boolean

With ActiveWindow
.Left = 0
.Top = 0
'see if we should stretch the .Width or the .Height
If .Width .Height Then
StretchWidth = True
.Width = Application.UsableWidth
Else
StretchWidth = False
.Height = Application.UsableHeight
End If
End With

ResizeActiveWindow = StretchWidth

End Function

NickHK

"Ed" wrote in message

oups.com...



I've got XL2003. I noticed the "CompareSideBySide" in the Window
menu, and thought I would explore that in VBA. I use two monitors and
spread the Excel application across both, with two workbooks open, one
i each monitor. I was hoping a simple macro could resize everything
and place the two workbooks, rather than having to resize everything
manually.


But I can't find much on the CompareSideBySide method. Everything
I've seen specifies only one workbook name. My Personal.xls always
opens with any other workbook because I have macros. I wonder if I
can specify the windows to resize and compare so Excel doesn't grab
the Personal window just because it's open.


If anyone has any insight or examples on using this, I would
appreciate the info. Thank you.
Ed- Hide quoted text -


- Show quoted text -



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
Please post this thread a correct full method, method about Nast Runsome New Users to Excel 8 February 25th 08 03:29 PM
Please post this thread a complete correct method, method about te Nast Runsome New Users to Excel 0 February 23rd 08 09:42 PM
Help with method CarolineHedges[_13_] Excel Programming 7 July 31st 06 03:29 PM
GetObject method not work after Call Shell Method ben Excel Programming 8 February 21st 06 03:45 PM
Why QUIT method doesn't work after COPY method? surotkin Excel Programming 3 October 26th 05 04:32 PM


All times are GMT +1. The time now is 09:56 AM.

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

About Us

"It's about Microsoft Excel"