Change Text Color in a Word VBA Shape
Question details
Set the color and size of text inside an inserted Word shape using VBA without relying on TextEffect.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- A user is formatting a number inside an inserted triangle shape with a Word VBA macro.
- Observed behavior
- Using TextEffect.FontSize with the standard shape causes an error, and the triangle may appear in an unexpected color.
Open Word and make sure you can access the VBA editor from the Developer tab. Test the macro in a new blank document to check whether existing default shape formatting affects the result.
Format the Shape Text with TextFrame.TextRange
Use the shape's text range to set the number's font color and size, and format the triangle's outline separately.
TextFrame.TextRange controls ordinary text inside a shape. TextEffect is intended for WordArt and is not the appropriate way to set the font size of a standard shape.
In Word, open Developer > Visual Basic, then select Insert > Module.
Paste this example into the module: Sub AddTriangleWithBlackText() Dim shp As Shape Set shp = ActiveDocument.Shapes.AddShape( _ Type:=msoShapeIsoscelesTriangle, Left:=72, Top:=72, _ Width:=100, Height:=80) With shp .TextFrame.TextRange.Text = "1" .TextFrame.TextRange.Font.ColorIndex = wdBlack .TextFrame.TextRange.Font.Size = 8 .TextFrame.TextRange.ParagraphFormat.Alignment = wdAlignParagraphCenter .Line.Visible = msoTrue .Line.ForeColor.RGB = RGB(0, 0, 0) End With End Sub
Place the cursor inside the macro and select Run > Run Sub/UserForm. Check that the number and triangle outline appear black; adjust Width or Height in the macro if the text needs more room.

Check Default Shape Formatting in a New Document
Use this check if the same macro produces an unexpected shape color in an existing document.
Edit Shape Text in WPS Writer
WPS Office is a free, lightweight alternative with a familiar interface for editing documents and formatting shape text. Its Microsoft Word format compatibility helps you move documents between suites, though it does not fix errors in Microsoft Word VBA macros.

Frequently Asked Questions
How do I make the text inside a Word shape black with VBA?
Set the shape's text range color with shp.TextFrame.TextRange.Font.ColorIndex = wdBlack, where shp is your Shape object.
Why does TextEffect.FontSize cause an error?
TextEffect is intended for WordArt rather than ordinary text in a standard shape. Use shp.TextFrame.TextRange.Font.Size = 8 to set the text size.
How do I change the triangle outline without changing its text?
Set shp.Line.Visible = msoTrue and shp.Line.ForeColor.RGB = RGB(0, 0, 0). Use TextFrame.TextRange.Font to format the text separately.
Why does the shape look different in another document?
The document may have different default shape formatting. Run the macro in a new blank document and explicitly set the font and outline colors to compare the results.




