Shapes With VBA - Add a new text-box
Use : To add a new text-box using vba
Sub add_textbox_VBA()
Dim shp As Shape
Set shp = ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 100, 100, 200, 50) ' add shape
With shp
.TextFrame.Characters.Text = "Example" ' add text to display
.Top = Range("e2").Top ' adjust top
.Left = Range("e2").Left 'adjust left
.TextFrame.AutoSize = True ' turn on autosize
.Fill.ForeColor.RGB = RGB(255, 255, 204) 'choose fill color
.Line.Weight = 1 ' adjust width
.Line.ForeColor.RGB = RGB(255, 0, 18) ' choose color
.Line.DashStyle = msoLineSolid ' choose style
End With
End Sub
- Ashish Koul's blog
- Login or register to post comments
- 31358 reads
Recent comments
5 years 34 weeks ago
6 years 20 weeks ago
6 years 32 weeks ago
6 years 35 weeks ago
6 years 36 weeks ago
6 years 42 weeks ago
6 years 50 weeks ago
6 years 50 weeks ago
6 years 50 weeks ago
6 years 50 weeks ago