Centers Text in Msgbox, Listview, Form Caption, Ect.
Centers Text in Msgbox, Listview, Form Caption, Ect.
API Declarations
*The MaxChars is what the text will be centered by, if the length of Text is 10 and the MaxChars is 30, then 10 spaces will be on each side of Text.
Rate Centers Text in Msgbox, Listview, Form Caption, Ect.
(2(2 Vote))
Public Function Center(Text As String, MaxChars As Integer) As String
spcs = Int(Len(Text) / 2)
cntr = Int(MaxChars / 2)
ctr = Space(cntr - spcs) & Text & Space(cntr - spcs)
Do Until Len(ctr) = MaxChars + 3
ctr = " " & ctr
Loop
Center = ctr
End Function
Centers Text in Msgbox, Listview, Form Caption, Ect. Comments
No comments yet — be the first to post one!
Post a Comment