Meesha
Meesha

Reputation: 821

The text box background color doesn't disappear

Set shp = aslide.Shapes.AddShape(Type:=msoShapeRectangle, Left:=50, Top:=185, Width:=600, Height:=26.6)
    shp.Line.Visible = msoFalse
    shp.TextFrame.TextRange.Font.Color.RGB = RGB(10, 47, 93)
    shp.TextFrame.TextRange.Characters.Text = "HI"
    shp.TextFrame.TextRange.Paragraphs.ParagraphFormat.Alignment = ppAlignLeft
    shp.TextFrame2.VerticalAnchor = msoAnchorMiddle
    shp.TextFrame2.TextRange.Font.Size = 28
    shp.TextFrame2.TextRange.Font.Name = "Arial"

I have a default layout for my slides in a light blue color, but when I add this text box, i want the text color to be dark blue which it is, and I can see the text, but the background of the text box does not disappear even when I haven't used a fill function. How to solve this, it looks really terrible. Thanks in advance.

Upvotes: 0

Views: 2362

Answers (1)

Dportology
Dportology

Reputation: 808

I think this should do the trick:

shp.Fill.Transparency = 0
shp.Fill.ForeColor.RGB = RGB(0, 0, 0)
shp.Fill.BackColor.RGB = RGB(0, 0, 0)

Sets your back color and forecolor on the shape to black, just switch this color out to match your background color in RGB and you should be fine.

Alternatively, I just tested setting the transparency to full ie:

shp.Fill.Transparency = 1

and this works, as it just ignores whatever color was set by default.

Upvotes: 1

Related Questions