Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Position Userform In Cells Portion of Excel Only

I have several userforms, some larger than peoples screens. When the user
with a little screen clicks a button on Sheets("QUOTE") the userform opens
and it is too large to fit on their screen, thus not giving them the ability
to see all the controls on the userform.

What I want to do is before each userform is opened run code that will test
if the userform is larger than the displayed cells portion of Excel then add
both scroll bars to the userform so the user can access all controls.

I have this already, but it opens the userform at the very top of the
application screen, blocking the ribbon (2007) or menu bars (2003). I'd like
the userforms top left corner to start in the top left corner of Range("A1"),
is this possible?

Sub AdjustScreenSize()

' move user form to upper left of cells and show scoll bars
With ProductForm
If .Height Application.Height Or .Width Application.Width Then

' adjust form properties
.StartUpPosition = 0 ' manual
.ScrollBars = 3 ' show both scroll bars
.ScrollHeight = .Height ' scroll bar equals height of form
.ScrollWidth = .Width ' scroll bar equals width of form

.Top = ActiveSheet.Range("A1").Top
.Left = ActiveSheet.Range("A1").Left
.Height = Application.Height
.Width = Application.Width
End If
End With

End Sub


Thanks in Advance,
--
Cheers,
Ryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Position Userform In Cells Portion of Excel Only

Hi. A bit better but still not perfect:

In the userform:
Me.Top = Application.Top + (Application.Height - Application.UsableHeight)
Me.Left = Application.Left + (Application.Width - Application.UsableWidth)
It is not exactly on A1, you would have to substract the status bar height;
similar thing for the left property.

However, in terms of Height and Width, you can use Application.UsableHeight
and Application.UsableWidth

I hope this helps.

Sebastien
"Ryan H" wrote:

I have several userforms, some larger than peoples screens. When the user
with a little screen clicks a button on Sheets("QUOTE") the userform opens
and it is too large to fit on their screen, thus not giving them the ability
to see all the controls on the userform.

What I want to do is before each userform is opened run code that will test
if the userform is larger than the displayed cells portion of Excel then add
both scroll bars to the userform so the user can access all controls.

I have this already, but it opens the userform at the very top of the
application screen, blocking the ribbon (2007) or menu bars (2003). I'd like
the userforms top left corner to start in the top left corner of Range("A1"),
is this possible?

Sub AdjustScreenSize()

' move user form to upper left of cells and show scoll bars
With ProductForm
If .Height Application.Height Or .Width Application.Width Then

' adjust form properties
.StartUpPosition = 0 ' manual
.ScrollBars = 3 ' show both scroll bars
.ScrollHeight = .Height ' scroll bar equals height of form
.ScrollWidth = .Width ' scroll bar equals width of form

.Top = ActiveSheet.Range("A1").Top
.Left = ActiveSheet.Range("A1").Left
.Height = Application.Height
.Width = Application.Width
End If
End With

End Sub


Thanks in Advance,
--
Cheers,
Ryan

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
UserForm position Steve Excel Discussion (Misc queries) 1 August 26th 07 04:50 AM
Buttons in lower portion of workbook appear in upper portion ToferKing Excel Programming 1 April 22nd 06 06:46 PM
Position of a UserForm MD Excel Programming 2 April 12th 05 12:29 AM
Userform Position Pete Excel Programming 4 February 20th 05 12:01 AM
UserForm position Tim Excel Programming 2 February 12th 04 03:20 PM


All times are GMT +1. The time now is 10:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"