Dillydill123
Dillydill123

Reputation: 693

How to add an outline to a Text Box in VBScript

I am creating a basic text box in excel using VBScript:

Dim TextBox
Set TextBox = objWorksheet.Shapes.AddTextBox(1, 57, 31.8, 228.24, 18.72)
TextBox.TextFrame.Characters.Text = "Test"
TextBox.TextFrame.Characters.Font.Bold = True
TextBox.TextFrame.Characters.Font.Size = 14
TextBox.TextFrame.Characters.Font.Name = "Arial"
TextBox.TextFrame.Characters.Font.Color = RGB(0, 0, 0)

I want to add a black outline to this textbox. How do I accomplish this? I can't seem to find any documentation on the properties of textboxes and such.

Upvotes: 0

Views: 839

Answers (2)

JetSetJim
JetSetJim

Reputation: 78

This should help - I used the macro recorder to get this code, so a little bit of tidying needed

ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 330.75, 76.5, 139.5 _
    , 125.25).Select
With Selection.ShapeRange.Line
    .Visible = msoTrue
    .ForeColor.RGB = RGB(0, 0, 0)
    .Transparency = 0
End With

Upvotes: 2

BruceWayne
BruceWayne

Reputation: 23285

Using the macro recorder, I got this:

With TextBox.ShapeRange.Line
    .Visible = msoTrue
    .ForeColor.ObjectThemeColor = msoThemeColorText1
    .ForeColor.TintAndShade = 0
    .ForeColor.Brightness = 0
    .Transparency = 0
End With

Upvotes: 2

Related Questions