PictureFormat.TransparentBackground property (Excel)
Use the TransparencyColor property to set the transparent color. Applies to bitmaps only. Read/write MsoTriState.
Syntax
expression.TransparentBackground
expression A variable that represents a PictureFormat object.
Remarks
The parts of the picture that are the color defined as the transparent color appear transparent.
If you want to be able to see through the transparent parts of the picture all the way to the objects behind the picture, you must set the Visible property of the picture's FillFormat object to False.
If your picture has a transparent color and the Visible property of the picture's FillFormat object is set to True, the picture's fill will be visible through the transparent color, but objects behind the picture will be obscured.
Example
This example sets the color that has the RGB value returned by the function RGB(0, 24, 240) as the transparent color for shape one on myDocument. For the example to work, shape one must be a bitmap.
blueScreen = RGB(0, 0, 255)
Set myDocument = Worksheets(1)
With myDocument.Shapes(1)
With .PictureFormat
.TransparentBackground = True
.TransparencyColor = blueScreen
End With
.Fill.Visible = False
End With
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.