PC Review


Reply
Thread Tools Rate Thread

Detect top, left & height of activeworkbook? How do?

 
 
Chet
Guest
Posts: n/a
 
      20th Nov 2009
Anyone know how to detect the position (top, left & ht) of a given
open workbook? I am trying to show all open workbooks in a flowing
style so I can see them all. I know that the cascade style position
exists but I want to have more control over the position of each of
these open workbooks so I can see them better.

Thanks, Chet
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      20th Nov 2009
Try something like this -

Sub Cascader()
Dim cnt As Long, i As Long, n As Long
Dim w As Single, h As Single
Dim wn As Window

Application.ScreenUpdating = False
Application.WindowState = xlMaximized

With ActiveWindow
.WindowState = xlMaximized
w = .Width - 6
h = .Height - 24
End With

ReDim saNames(1 To Application.Windows.Count)

With Application.Windows
For i = 1 To .Count
With .Item(i)
If .Visible Then
cnt = cnt + 1
saNames(cnt) = .Caption
End If
End With
Next
End With

Application.EnableEvents = False

With Application.Windows

For i = cnt To 1 Step -1
Set wn = .Item(saNames(i))
With wn
.WindowState = xlNormal
.Activate
.Left = n * 21 + 3
.Top = n * 24 + 3
.Width = w - .Left
.Height = h - .Top - 3

If .Top > h * 0.7 Then n = 0
End With

n = n + 1
Next

End With

Application.ScreenUpdating = True
Application.EnableEvents = True

End Sub


Regards,
Peter T

"Chet" <(E-Mail Removed)> wrote in message
news:0fc2eec3-d4e9-4133-9310-(E-Mail Removed)...
> Anyone know how to detect the position (top, left & ht) of a given
> open workbook? I am trying to show all open workbooks in a flowing
> style so I can see them all. I know that the cascade style position
> exists but I want to have more control over the position of each of
> these open workbooks so I can see them better.
>
> Thanks, Chet



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How do you detect a Left click on a Worksheet Claus Busch Microsoft Excel Programming 0 17th Jul 2011 05:35 PM
Selection.width / .height / .left / .top from cell refor userform =?Utf-8?B?SkIyMDEw?= Microsoft Excel Programming 6 7th Mar 2007 05:50 PM
iwebbrowser2's left, top, width and height functions do not work inside SetSite omerfarukozer Windows XP Internet Explorer 2 25th Mar 2006 08:50 AM
treeview dock = left, right, fill, uses full height JohnnyB via DotNetMonster.com Microsoft Dot NET 2 11th May 2005 02:09 PM
.AddShape(Type, Left, Top, Width, Height) =?Utf-8?B?QUEyZTcyRQ==?= Microsoft Excel Programming 2 2nd Feb 2005 01:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:39 AM.