Execute o código a seguir.
Sub Macro1()
'Delete all shapes
For i = ActiveSheet.Shapes.Count To 1 Step -1
ActiveSheet.Shapes(i).Delete
Next i
'Add rectangle
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, Left:=50, Width:=100, Top:=50, Height:=40)
.TextFrame2.MarginLeft = 0
.TextFrame2.MarginRight = 0
.TextFrame2.MarginTop = 0
.TextFrame2.MarginBottom = 0
.TextFrame2.VerticalAnchor = msoAnchorMiddle
.TextFrame2.TextRange.ParagraphFormat.Alignment = msoAlignCenter
.TextFrame2.TextRange.Font.Size = 30
.TextFrame2.AutoSize = msoAutoSizeTextToFitShape
.TextFrame2.TextRange.Characters.Text = "Stackoverflow"
End With
End Sub
A imagem a seguir mostra minha pergunta.
desde já, obrigado
Você pode tentar isso?
Seu código de macro já inclui ".TextFrame2.TextRange.Font.Size = 30". Você pode alterar 30 para 17 ou precisa do tamanho da fonte.