MS Excel VBA

How to save a chart in excel as an image (save as PNG, JPG, BMP)

How to save a chart in excel as an image (save as PNG, JPG, BMP)

How to save a chart in excel as an image (save as PNG, JPG, BMP)

There are several helpful built-in charts in Excel, and you can combine them to make some truly stunning combo charts. Excel charts are a terrific method to make it visually appealing when you need to present data to your management or clients.

Even if your charts could be in Excel, it doesn’t always make it the optimal format for presenting them to clients or management. These charts would frequently need to be displayed in a PowerPoint or Word document with PDFs.

Excel VBA

If Excel had a built-in option to save charts as photos, that would be fantastic, but it doesn’t.

However, there are a few simple ways to save and export Excel charts as pictures (JPG, PNG, and BMP are a few common ones), and I’ll go through these techniques in this lesson.

How many charts you have will determine the approach I use. Utilize the copy-paste approach if you just have a few charts to save as pictures; if you have many, it’s preferable to use the “download as HTML” or VBA methods.

This instruction explains:

1. The Chart to Copy and Save as an Image (MS Paint or Other Graphics Tool)
2. Save every chart in the workbook at once as an image.
3. Using VBA, save every chart as an image.
4. Excel charts may be copied and pasted as images in MS Word or PowerPoint.

1. The Chart to Copy and Save as an Image (MS Paint or Other Graphics Tool)

The practice of capturing a snapshot of the complete screen is one that I see a lot of people do (this can be done by hitting the PrintScreen key). After completing this, you may paste the screenshot into MS Paint (or your preferred program) and then delete all other elements to leave only the image.

Excel VBA

While this method of saving a chart as a picture is good and effective, there is a better option (which takes less time and the images are more accurate).

Let’s say you have an Excel file with the following chart:

The steps to save this graph or chart as a picture are as follows:

  1. To save a chart, perform a right-click.
  2. Select “Copy”
  3. Launch MS Paint (or whatever tool you use)
  4. Put the picture in (Control V works for MS Paint)
  5. Simply pick and drag any additional white space to remove it, leaving only the chart.
  6. Go to the File tab.
  7. Choose Save As.
  8. Select the image format to save the chart in by clicking on it (there is JPG, PNG, and BMP format).

The advantage of this approach overtaking a screenshot is that you only need to copy the chart once, and MS Paint only has to be used once to fix the white space (this may not be necessary if you’re using any other graphics application).

Excel VBA

If you already have two or more charts arranged in Excel and wish to save the full arrangement as a picture, just pick all the charts, copy them, and then paste them into MS Paint.

2. Save every chart in the workbook at once as an image.

If you have a workbook that has a lot of charts and you want to save all these charts in one go, a better way is to save the Excel workbook as an HTML file.

When you do this, all the charts in your Excel workbook will be saved as PNG format images in the downloaded folder.

Suppose you have an Excel workbook with multiple sheets of charts.

Excel VBA

Below are the steps to save the file as HTML and save the Excel charts as images in PNG format:

 

Open the workbook containing the charts.

Go to the File tab.

Choose “Save As”

Select the place where you want to store each of the chart pictures by clicking Browse and choosing it.

The ‘Save as type’ should be changed to Web Page (*.htm, *.html).

Select “Save”

Your Excel document will be saved in the designated folder as a web page.

You can now access all of the charts as pictures by going to the folder and selecting the Filename files folder (where FileName would be the name you gave to the file while saving it).

You may see all the charts that have been saved as PNG pictures when you access this folder.

For each chart, my system provided me with two identical photos when I attempted this. It will therefore produce eight photos for four charts.

Caution:

Make care to save a backup copy of the Excel file before saving it as HTML. Additionally, when you save a file as HTML, the open file is no longer in Excel format but rather an HTML file. Once the file has been saved, you should open the Excel version and dismiss the current file, which will now be an HTML file (this is why it’s crucial to make a backup).

Excel VBA

3. Using VBA, save every chart as an image.

Additionally, you may easily save charts from an Excel worksheet to a certain folder by using a VBA code.

Use the VBA code below if you simply need to save the current chart—the one you’ve chosen—into a certain folder:

ActiveChart.Export ":\Users\sumit\Desktop\Example\ChartName.png"

The aforementioned code will store the current chart in the Example folder as a PNG file with the name ChartName. Depending on where you want the chart, you can alter the name and location of the folder.

You may use the code below to save an image or photograph in the JPG format:
ActiveChart.Export ":\Users\sumit\Desktop\Example\ChartName.jpg"

By pasting this VBA code into the current window, positioning the cursor at the end of the line, and pressing the Enter key, you may run it (or you can put it in a regular module and run the code from there).

However, if you have several charts, this approach would take a lot of time. You may do this by using the somewhat longer VBA code listed below:

Sub SaveChartsasImages()
Dim i As Integer
Dim CurrentActiveSheet As Worksheet

Application.ScreenUpdating = False
Application.EnableEvents = False

Set CurrentActiveSheet = ActiveSheet

For Each Sht In Worksheets
    For Each cht In ActiveSheet.ChartObjects
        cht.Activate
        i = i + 1
        ActiveChart.Export "C:\Users\sumit\Desktop\Example\" & Sht.Name & "_chart" & i & ".png"
    Next chart
Next Sht

CurrentActiveSheet.Activate

Application.ScreenUpdating = True
Application.EnableEvents = True

End Sub

The code mentioned above traverses each worksheet in the workbook before going to each chart within each worksheet. The chart is then picked and saved in the designated folder.

The For Each Next loop is used for all of this looping.

Excel VBA

The charts are further recorded using the name format worksheetname chartNumber. This would make it possible for you to tell which chart relates to which worksheet.

The ability to modify the code to just save charts as pictures from particular sheets is another benefit of utilizing VBA. For instance, you may change the code such that charts are only saved from sheets with the prefix 2020 in them (this can be done using an IF THEN ELSE statement after the FOR loop line)

4. Excel charts may be copied and pasted as images in MS Word or PowerPoint.

You must often show your charts in Microsoft Word or PowerPoint documents. If you’re writing client reports or documentation, this is frequently the case.

You can copy and paste a picture in Word or PowerPoint just as you do in MS Paint.

But there is one distinction…

Excel VBA

A chart or graph copied from Excel cannot be put as an image into Microsoft Word or PowerPoint. A “Microsoft Office Graphic Object” is pasted instead.

For those who want the chart to stay a chart even when they are editing and formatting it in MS Word or PowerPoint, this option is helpful. Additionally, this style of the chart is still linked to the Excel data, so it will update if you change the data in the backend.

However, if you wish to paste this chart as an image, follow these instructions (note that while I’ll be using MS Word in this example, they would also apply to PowerPoint):

The chart you wish to copy to MS Word should be selected.

Right-click, then choose Copy.

Open the MS Word document you wish to use to paste this chart into.
Click on the Paste icon under the Clipboard category on the Home pane (the downward-pointing arrow part).

Select the Paste as Picture option from the list of choices that appears.

By following the instructions above, the chart would be pasted as an image.

The graph won’t be pasted as an image if you just click the Paste button without selecting Paste as Picture.

These are the four quickest ways to save Excel charts as photos. Some techniques also let you select the image’s format (such as using MS Paint or VBA).

Excel VBA

If you simply have a few charts, you may utilize the MS Paint approach, but it’s preferable to use HTML or VBA code if you want to store several charts spread across several pages. Additionally, it is preferable to simply copy and paste these charts as a graphic in Word or PowerPoint if the ultimate goal is to include them there.

I hope this instruction was helpful.

Leave a Comment

Your email address will not be published. Required fields are marked *


Scroll to Top