Name

chartfillformat.UserPicture(PictureFile)

Synopsis

Applies a picture to a fill. Pictures are stretched to fit the fill area.

Argument

Settings

PictureFile

The filename of the picture to apply

Tip

Help specifies additional arguments for this method, but they can’t be used with the ChartFillFormat object.

The following code applies a picture to the chart area:

Sub UserPictureFill( )
    Dim chrt As Chart, cf As ChartFillFormat
    ' Get the chart.
    Set chrt = ActiveChart
    ' Get the chart area fill.
    Set cf = chrt.ChartArea.Fill
    ' Make the fill visible.
    cf.Visible = True
    ' Display a picture.
    cf.UserPicture ThisWorkbook.Path & "\logo.bmp"
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.