ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Window Resize (https://www.excelbanter.com/excel-programming/298209-re-window-resize.html)

steveb[_4_]

Window Resize
 
Ryan,

A simple record of a macro produced the following code:
see if this helps...

''''''''''''''''
Application.WindowState = xlNormal
Application.Left = 155.5
Application.Top = 35.5
Application.Width = 700
Application.Height = 500
'''''''''''''''''''''''''''''''''''''''

--
steveb
(Remove 'NOSPAM' from email address if replying direct)


"Ryan" wrote in message
...
I have a command button in a spreadsheet that opens up another

spreadsheet. I want to know how I can set it so that when the second
spreadsheet opens, I can set the size of the window it is in, or at least
have it not maximized or minimized.

Ryan




steveb[_4_]

Window Resize
 
Ryan,

Excel is funny this way. Either/Or.

So I recorded (and modified) another macro and reduced one workbook and
enlarged the second to fit the screen....
There are ways to have the code identify the windows with variables.

''''''''''''''''
With Windows("Book1.xls")
.Top = 1
.Left = 5
End With
With Windows("Book1.xls")
.Width = 691.5
.Height = 432
End With
With Windows("Book2.xls")
.Top = 100
.Left = 50
End With
With Windows("Book2.xls")
.Width = 200
.Height = 100
End With
'''''''''''''''''''''''''''

--
steveb
(Remove 'NOSPAM' from email address if replying direct)


"Ryan" wrote in message
...
Steve,

The code that you gave me works almost perfectly. The one problem is that

it resizes the original workbook too. I want it so that Excel stays
maximized but the new workbook is smaller. I will play around with it some
and see if I can figure it out, but if anyone knows how to fix this problem
please post.

Ryan




Jim Rech

Window Resize
 
In place of "Application" use "ActiveWindow".

--
Jim Rech
Excel MVP
"Ryan" wrote in message
...
| Steve,
|
| The code that you gave me works almost perfectly. The one problem is that
it resizes the original workbook too. I want it so that Excel stays
maximized but the new workbook is smaller. I will play around with it some
and see if I can figure it out, but if anyone knows how to fix this problem
please post.
|
| Ryan




All times are GMT +1. The time now is 08:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com