Vertical text on command button

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,224
Office Version
  1. 2007
Platform
  1. Windows
Hi,
As per titlae i have a vertical button & would like to have text top to bottom as opposed the normal left to right.
Is this possible ?
Please advise

Many Thanks
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
If it's a forms control button, then yes.
 
Upvote 0
Something Like :-
Code:
Private Sub CommandButton1_Click()
CommandButton1.Caption = "This" & vbLf & "Button" & vbLf & "Is" & vbLf & "CommandButton1"
End Sub
 
Upvote 0
Something Like :-
Code:
Private Sub CommandButton1_Click()
CommandButton1.Caption = "This" & vbLf & "Button" & vbLf & "Is" & vbLf & "CommandButton1"
End Sub


Hi,
I have applied your advised code to the button but it is still horizontal.
I have copy/paste as shown below but it doesnt take into consideration my TEST TEXT on the buttons Caption part.

Code:
Private Sub CommandButton1_Click()CommandButton1.Caption = "This" & vbLf & "Button" & vbLf & "Is" & vbLf & "CommandButton1"
End Sub

What did i miss on how to do this correctly.
Thanks
 
Upvote 0
Do you mean you want every letter to be listed one below the other, or does the code not produce the text in the code ???
Please show what you expect to see in the Command Button.
 
Last edited:
Upvote 0
If you mean you want the text in your Button to look like this:

W
E
L
C
O
M
E


I would use a Shape for a button.

Click the shape choose format shape and choose TextBox then choose Text Direction Stacked
 
Upvote 0
Do you mean you want every letter to be listed one below the other, or does the code not produce the text in the code ???
Please show what you expect to see in the Command Button.

I have applied the code to the button as in post #3
leaving at default Command Button that is what i see left to right.
I changed it to TEST TEXT but still left to right.

I thought it would be
T
E
S
T

T
E
X
T
 
Upvote 0
Try this:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG28Jun54
[COLOR="Navy"]Dim[/COLOR] nstr  [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String,[/COLOR] n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]

[COLOR="Navy"]For[/COLOR] n = 1 To Len("Test Text")
    nstr = nstr & IIf(nstr = "", Mid("Test Text", n, 1), Chr(10) & Mid("Test Text", n, 1))
[COLOR="Navy"]Next[/COLOR] n
CommandButton1.Caption = nstr

'[COLOR="Green"][B]NB:- The code line below will fill a Forms "Button" if required.[/B][/COLOR]
'[COLOR="Green"][B]ActiveSheet.Shapes("Button 3").OLEFormat.Object.Caption = nstr[/B][/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
I have applied the code to the button as in post #3
leaving at default Command Button that is what i see left to right.
I changed it to TEST TEXT but still left to right.

I thought it would be
T
E
S
T

T
E
X
T
If you are using an ActiveX command button, then use these two lines of code in whatever procedure you plan to initialize the command button with...
Code:
CommandButton1.WordWrap = True
CommandButton1.Caption = Replace(StrConv("TEST TEXT", vbUnicode), Chr(0), vbLf)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,022
Members
448,939
Latest member
Leon Leenders

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top