Name

chart.CopyPicture([Appearance], [Format], [Size])

Synopsis

Copies the image of a chart into the clipboard.

Argument

Settings

Appearance

The resolution of the image. Can be one of these settings: xlPrinter, xlScreen. Default is xlScreen.

Format

The image format. Can be one of these settings: xlBitmap, xlPicture. Default is xlPicture.

Size

xlScreen sizes the picture to match the size displayed on screen; xlPrinter sizes the picture to match the printed size.

The following code copies a bitmap of a chart onto the clipboard so that it can be later pasted by the user:

Sub DemoCopyPicture(  )
    Dim chrt As Chart
    Set chrt = Charts("Demo Chart Types")
    ' Copy a chart image into the clipboard.
    chrt.CopyPicture xlScreen, xlBitmap
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.