ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to bottom-align a control on a UserForm? (https://www.excelbanter.com/excel-programming/411093-how-bottom-align-control-userform.html)

[email protected]

How to bottom-align a control on a UserForm?
 
I've dropped a button on a UserForm. The UserForm is user-resizeable
(thanks to Bullen's FunForm.)

What height property or other vertical quantity do I access in order
to programmatically position the button flush against the bottom of
the form? I want to re-bottom-justify the button in UserForm_Resize
(hope that's the correct event).

I've tried:

1) UserForm.Height seems to be useless, because it seems to include
the form's caption area. So if I say:

Button1.Top = UserForm.Height - Button1.Height

then the button's too low by approx. UserForm's caption.

2) Application.UseableHeight sounds promising, but on one Win 2K PC it
seems to return Excel's own (or possibly the open workbook's) useable
height, which is, like 100 pixels (points?) larger than
UserForm.Height.

(BUT, on another Win 2K PC with a different screen res., the button
ends up aligning PERFECTLY, no matter how the user resizes the form.
Don't quite understand THAT coincidence.)

3) UserForm has no UseableHeight property that I can see.

I suppose another way of asking this is: Is there a way to determine
the height of an application's caption area?

Thanks much.

***

ctm

How to bottom-align a control on a UserForm?
 
I think they are only able to be set from the TOP of the form not the
bottom.(could be wrong though)

Is the form height programmed ? If so you could probably use that code to
set the button position.
If not i think you would have to adopt the button TOP procedure.

Ctm


wrote in message
...
I've dropped a button on a UserForm. The UserForm is user-resizeable
(thanks to Bullen's FunForm.)

What height property or other vertical quantity do I access in order
to programmatically position the button flush against the bottom of
the form? I want to re-bottom-justify the button in UserForm_Resize
(hope that's the correct event).

I've tried:

1) UserForm.Height seems to be useless, because it seems to include
the form's caption area. So if I say:

Button1.Top = UserForm.Height - Button1.Height

then the button's too low by approx. UserForm's caption.

2) Application.UseableHeight sounds promising, but on one Win 2K PC it
seems to return Excel's own (or possibly the open workbook's) useable
height, which is, like 100 pixels (points?) larger than
UserForm.Height.

(BUT, on another Win 2K PC with a different screen res., the button
ends up aligning PERFECTLY, no matter how the user resizes the form.
Don't quite understand THAT coincidence.)

3) UserForm has no UseableHeight property that I can see.

I suppose another way of asking this is: Is there a way to determine
the height of an application's caption area?

Thanks much.

***




[email protected]

How to bottom-align a control on a UserForm?
 
ctm:

Thanks very much for reply.

But I think I've found the answer, namely: PIADAU (Programmer Is A
Doofus As Usual).

I *completely* didn't notice InsideHeight (and companion InsideWidth)
in UserForm's list of properties.

Tried it on the problematic PC, and it works.

I feel this property is so important, I'll post another thread.

Thanks again.

***


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

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