Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Resize Excel Window

Using Excel 2003, is there a way to resize the Excel window from within VBA? I
don't mean the window for a particular workbook like:

With ActiveWindow
.Width = Application.UsableWidth
End With

I'm referring to the entire Excel window that the OS opens when you invoke Excel.

Thanks.

Bill
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Resize Excel Window

Maybe...

Application.WindowState = xlMaximized

There are a couple other options, too. Check VBA's help for more info.

Bill Martin wrote:

Using Excel 2003, is there a way to resize the Excel window from within VBA? I
don't mean the window for a particular workbook like:

With ActiveWindow
.Width = Application.UsableWidth
End With

I'm referring to the entire Excel window that the OS opens when you invoke Excel.

Thanks.

Bill


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Resize Excel Window

I did look at the VBA help Dave. All I find there is the code I mentioned which
only acts on the sub window and the Application.WindowState you mentioned. The
trouble with that is that it will minimize/maximize the window but it won't let
me tell it to make it some arbitrary size in between.

I suddenly had a "Duh..." moment though while playing with your response. I
tried simply recording a macro while resizing the window manually. Turns out
the following code does what I want:

Application.Left = -390
Application.Top = 87.4
Application.Width = 390
Application.Height = 528.6

The "Left" is negative simply because I'm positioning the window on a second
monitor.

Thanks.

Bill
---------------------------------------------
On 2/24/2010 11:01 AM, Dave Peterson wrote:
Maybe...

Application.WindowState = xlMaximized

There are a couple other options, too. Check VBA's help for more info.

Bill Martin wrote:

Using Excel 2003, is there a way to resize the Excel window from within VBA? I
don't mean the window for a particular workbook like:

With ActiveWindow
.Width = Application.UsableWidth
End With

I'm referring to the entire Excel window that the OS opens when you invoke Excel.

Thanks.

Bill



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Resize Excel Window

First you must find the Screen Width and Height :

'<< CODE FOR THE STANDARD MODULE

Option Explicit
Public ScrWidth&, ScrHeight&
Declare Function GetSystemMetrics32 Lib "User32" _
Alias "GetSystemMetrics" (ByVal nIndex&) As Long

Private Sub MonitorInfo()
ScrWidth = GetSystemMetrics32(0) '< in pixels
ScrHeight = GetSystemMetrics32(1)
End Sub

Then change the Top, Left, Width and Height properties.


With Application

.WindowState = xlNormal

.Top = 1
.Left = 1

.Width = 400 * ScrWidth / 800

.Height = 300 * ScrHeight / 600


End With

Mishell


"Bill Martin" a écrit dans le message de news:
...
I did look at the VBA help Dave. All I find there is the code I mentioned
which only acts on the sub window and the Application.WindowState you
mentioned. The trouble with that is that it will minimize/maximize the
window but it won't let me tell it to make it some arbitrary size in
between.

I suddenly had a "Duh..." moment though while playing with your response.
I tried simply recording a macro while resizing the window manually.
Turns out the following code does what I want:

Application.Left = -390
Application.Top = 87.4
Application.Width = 390
Application.Height = 528.6

The "Left" is negative simply because I'm positioning the window on a
second monitor.

Thanks.

Bill
---------------------------------------------
On 2/24/2010 11:01 AM, Dave Peterson wrote:
Maybe...

Application.WindowState = xlMaximized

There are a couple other options, too. Check VBA's help for more info.

Bill Martin wrote:

Using Excel 2003, is there a way to resize the Excel window from within
VBA? I
don't mean the window for a particular workbook like:

With ActiveWindow
.Width = Application.UsableWidth
End With

I'm referring to the entire Excel window that the OS opens when you
invoke Excel.

Thanks.

Bill





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
Excel: Expose whole window or at least top resize handles. Reinie Excel Discussion (Misc queries) 1 August 25th 09 04:11 PM
Resize and position excel window macroapa Excel Programming 3 October 22nd 08 03:34 PM
unable to get the excel app event trigger for for window resize [email protected] Excel Programming 0 November 30th 05 03:03 AM
Window Resize steveb[_4_] Excel Programming 2 May 13th 04 06:59 PM
Window Resize Jim Rech Excel Programming 1 May 13th 04 06:18 PM


All times are GMT +1. The time now is 12:36 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"