Add TextBox and format it : TextBox « Forms « VBA / Excel / Access / Word





Add TextBox and format it

 

                           
Sub AddTextBox()
    ActiveSheet.Shapes.AddTextBox(msoTextOrientationHorizontal, 2.5, 1.5, _
        116, 145).TextFrame.Characters.text = "This is a test of inserting a text box to a sheet and adding some text."
    With Selection.Characters(Start:=1, Length:=216).font
        .name = "Arial"
        .FontStyle = "Regular"
        .size = 10
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
    End With
    range("I15").Select
End Sub

 










Related examples in the same category

1.Set the selection in a TextBox
2.Read input from TextBox and assign the value to ActiveCell
3.Copy workbook differences to the worksheet