Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Resize and position excel window

Hi,

I am trying to write some vba code that when run will resize the Excel
window and repostition the window (to the top right of the screen).

I have found simliar code that works for MSAccess, but I'm struggling
to re-write it for excel.

Any help appreciated.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Resize and position excel window

Hi,

Try this in a general module and adjust the numbers to get what you want

Sub resize()
With Application
.WindowState = xlNormal
.Left = 450
.Top = 1
.Width = 500
.Height = 500
End With
End Sub

Mike

"macroapa" wrote:

Hi,

I am trying to write some vba code that when run will resize the Excel
window and repostition the window (to the top right of the screen).

I have found simliar code that works for MSAccess, but I'm struggling
to re-write it for excel.

Any help appreciated.

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Resize and position excel window

Hi Macroapa

The code below should do what you want, it will set the width and
height to 75% of the full screen size but you can change this to an %
you want.

Option Explicit
Dim oldHeight, oldWidth As Long
Dim newHeight, newWidth As Long

Private Sub CommandButton1_Click()

With Application

oldHeight = .Height
oldWidth = .Width

newHeight = oldHeight / 100 * 75
newWidth = oldWidth / 100 * 75

.WindowState = xlNormal

.Height = newHeight
.Width = newWidth

.Top = 0
.Left = oldWidth - newWidth - 3

End With

Hope this helps

Steve
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Resize and position excel window

On 22 Oct, 10:36, Incidental wrote:
Hi Macroapa

The code below should do what you want, it will set the width and
height to 75% of the full screen size but you can change this to an %
you want.

Option Explicit
Dim oldHeight, oldWidth As Long
Dim newHeight, newWidth As Long

Private Sub CommandButton1_Click()

* * With Application

* * * * oldHeight = .Height
* * * * oldWidth = .Width

* * * * newHeight = oldHeight / 100 * 75
* * * * newWidth = oldWidth / 100 * 75

* * * * .WindowState = xlNormal

* * * * .Height = newHeight
* * * * .Width = newWidth

* * * * .Top = 0
* * * * .Left = oldWidth - newWidth - 3

* * End With

Hope this helps

Steve


thanks both, that's great.
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
Insert, position, and resize a picture w/ Macro John Excel Discussion (Misc queries) 1 July 10th 07 07:21 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:16 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"