add formatted textbox with no border

I like to write next to pictures or diagrams and put the writing into a textbox so that it can be moved around easily and is justified.

Adding a textbox needs several clicks to remove the border, remove the fill, set the font to Arial 11 and justify it. The code below will produce such a textbox with one click on the Quick Access Toolbar.

Sub TextBoxNoFillNoBorder()Dim Box As Shape
Set Box = ActiveDocument.Shapes.AddTextbox( _
Orientation:=msoTextOrientationHorizontal, _
Left:=50, Top:=50, Width:=100, Height:=100)With Box
.TextFrame.TextRange.Text = “text box here”
.Line.Visible = msoFalse
.Fill.Visible = msoFalse
.TextFrame.TextRange.Font.Name = “Arial”
.TextFrame.TextRange.Font.Size = “11”
.TextFrame.TextRange.Font.Color = wdColorBlack
.TextFrame.TextRange.ParagraphFormat.Alignment = wdAlignParagraphJustify
.TextFrame.TextRange.ParagraphFormat.LineSpacingRule = wdLineSpaceSingle
.TextFrame.TextRange.ParagraphFormat.SpaceBefore = 0
.TextFrame.TextRange.ParagraphFormat.SpaceBeforeAuto = False
.TextFrame.TextRange.ParagraphFormat.SpaceAfter = 0
.TextFrame.TextRange.ParagraphFormat.SpaceAfterAuto = False
End With
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: