Return to Snippet

Revision: 47195
at June 2, 2011 06:36 by win4me

Initial Code
''' Set Range you want to export to file
    Dim rgExp As Range: Set rgExp = Range("B5:H14")
    ''' Copy range as picture onto Clipboard
    rgExp.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
    ''' Create an empty chart with exact size of range copied
    With ActiveSheet.ChartObjects.Add(Left:=rgExp.Left, Top:=rgExp.Top, _
    Width:=rgExp.Width, Height:=rgExp.Height)
    .Name = "ChartVolumeMetricsDevEXPORT"
    End With
    ''' Paste into chart area, export to file, delete chart.
    ActiveSheet.ChartObjects("ChartVolumeMetricsDevEXPORT").Chart.Export "C:\testmeExportChart.jpg"

Initial URL

Initial Description
How to save Excel range into image file. VBA macro in Excel 2007.

Create an empty chart, paste range image into chart area, and Export as image file.

Modify code to suite to your needs.

Initial Title
VBA: Export excel range as image and save as file.

Initial Tags
image, code, excel

Initial Language
Visual Basic