Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Please post this thread a correct full method, method about | New Users to Excel | |||
Please post this thread a complete correct method, method about te | New Users to Excel | |||
Help with method | Excel Programming | |||
GetObject method not work after Call Shell Method | Excel Programming | |||
Why QUIT method doesn't work after COPY method? | Excel Programming |