ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Userform - Formating Text in a Label (https://www.excelbanter.com/excel-programming/327920-userform-formating-text-label.html)

TEB2

Userform - Formating Text in a Label
 
How do you vertically align text in a label on a userform?

Chip Pearson

Userform - Formating Text in a Label
 
I don't believe that Label controls support vertical alignment.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"TEB2" wrote in message
...
How do you vertically align text in a label on a userform?




TEB2

Userform - Formating Text in a Label
 
What can I do to make my text look centered in the label? Mine looks like it
is top centered?

"Chip Pearson" wrote:

I don't believe that Label controls support vertical alignment.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"TEB2" wrote in message
...
How do you vertically align text in a label on a userform?





Peter T

Userform - Formating Text in a Label
 
This came up recently in subject "CommandBar Caption Orientation" and Dave
Peterson suggested suggested:

"Separate each character by ctrl-enter (to force a new line)"

- which at the time I thought was a neat idea!

If your text has only one vertical line that should work for the label
caption.

Regards,
Peter T

"TEB2" wrote in message
...
How do you vertically align text in a label on a userform?




Stephen Bullen[_4_]

Userform - Formating Text in a Label
 
Hi Teb2,

What can I do to make my text look centered in the label? Mine looks like it
is top centered?


Use two labels, one for the background/border, one (transparent) for the text
and center them with code:

lblFront.Top = lblBack.Top + (lblBack.Height - lblFront.Height) \ 2

and the same for the left/width

Regards

Stephen Bullen
Microsoft MVP - Excel

Professional Excel Development
The most advanced Excel VBA book available
www.oaltd.co.uk/ProExcelDev




All times are GMT +1. The time now is 03:02 PM.

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