JorgenKjer
Board Regular
- Joined
- Aug 1, 2016
- Messages
- 65
- Office Version
- 2013
- Platform
- Windows
Hi
I have a small code that makes a shape with text. Are there anyone who can help change the code so that the three lines are centered horizontal in the shape?
Best regards Jorgen
Sub Shapes()
Sheet1.Shapes.SelectAll
Selection.Delete
Set sh = Sheet1.Shapes.AddShape(msoShapeRoundedRectangle, 25, 30, 150, 60)
sh.TextFrame2.TextRange.Text = "President" & vbNewLine & "George Washington" & vbNewLine & "1789 - 1797"
With sh.TextFrame2
.HorizontalAnchor = msoAnchorCenter
.VerticalAnchor = msoAnchorMiddle
End With
End Sub
I have a small code that makes a shape with text. Are there anyone who can help change the code so that the three lines are centered horizontal in the shape?
Best regards Jorgen
Sub Shapes()
Sheet1.Shapes.SelectAll
Selection.Delete
Set sh = Sheet1.Shapes.AddShape(msoShapeRoundedRectangle, 25, 30, 150, 60)
sh.TextFrame2.TextRange.Text = "President" & vbNewLine & "George Washington" & vbNewLine & "1789 - 1797"
With sh.TextFrame2
.HorizontalAnchor = msoAnchorCenter
.VerticalAnchor = msoAnchorMiddle
End With
End Sub
Last edited: