Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to centre (as I'm a Brit!) the caption on a userform in Excel 2010?

Status
Not open for further replies.

PWD

Technical User
Jul 12, 2002
823
GB
Good afternoon, I have searched the Interweb & I'm pretty sure it can't be done, but I've saved the best till last!

Why would you want to do such a thing"

Because it's there!

Basically I'm just playing around trying to learn stuff about forms and prefer heading-like text to be (OK) centered.

Many thanks,
D€$
 
OK, no to worry; thought I'd better check-in with those who really know their stuff! [smarty]

Many thanks,
D€$
 
I case you really wanted to achieve this, you could use the "width" property of your form and use the value to calculate the number of spaces you need to pad your caption from the left with until it is centered...
[ponder]


“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Well I'm resizing the width of the form and the listbox according to the lengths of the text (in this case filenames) so there may be some mileage in giving that a go. Thanx.

Many thanks,
D€$
 
This is what I've done:

Code:
UFC = UserForm2.Caption

'FileNameLen is the length of the longest filename

If FileNameLen > 20 Then
    For x = 1 To (FileNameLen - 20) * 4 / 5
    UserForm2.Caption = "  " & UserForm2.Caption 'You can't centre the caption so this is a (sort of) workaround
    Next x
    Else: UserForm2.Caption = "          " & UserForm2.Caption
    End If.
.
.
UserForm2.Caption = UFC
End Sub

Something like, anyway!! [pc]

Many thanks,
D€$
 
Do you need a true title bar in the userform? If not, it's not a problem to remove (api) it and add a label with centered text at the top.

combo
 
Hi guys, I was trying to enhance my Forms skills while running down to Christmas - leaving in ½ hr now! [bigsmile]
And it's Friday!!
Merry Christmas everyone.

Many thanks,
D€$
 
>enhance my Forms skills

Ah, but centering the Caption of a Windows is NOT enhancing your Forms skills ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top