0% found this document useful (0 votes)
2 views

How to export all images at once from Excel_

The document provides methods to export all images from an Excel workbook at once, either using the built-in Save As function or a tool called Kutools for Excel. It also includes a VBA code snippet for exporting images while renaming them based on adjacent cell values. The document is aimed at helping users save time and streamline their workflow when dealing with images in Excel.

Uploaded by

ishaqalikhan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

How to export all images at once from Excel_

The document provides methods to export all images from an Excel workbook at once, either using the built-in Save As function or a tool called Kutools for Excel. It also includes a VBA code snippet for exporting images while renaming them based on adjacent cell values. The document is aimed at helping users save time and streamline their workflow when dealing with images in Excel.

Uploaded by

ishaqalikhan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ExtendOf
ExtendOf ce
ce Products Download Purchase Resources Support Search

How to export all images at once from Excel?


Supposing you have a lot of pictures in your workbook and want to save them to a speci c folder at a time, usually, you can copy and paste the pictures one by one
manually for saving, but it is time-consuming to copy and paste them repeatedly like this. Here, I will introduce you some tips to solve this job.

Export all images at once from Excel with Save As function


Easily export all images at once from Excel with an amazing tool
Export images and rename them with the adjacent cell values

Export all images at once from Excel with Save As function

With the Excel built-in Save As function, you can save a workbook as Web Page to save all pictures including charts, shapes and other objects in a folder. Please do as
follows.

1. Open the workbook with the pictures you want to save. Click File > Save As > Browse.

By using this website, you agree to the use of


cookies as described in our Privacy Policy.

Ok

2. In the Save As dialog box, you need to:

2.1) Choose a folder to save the exported images;


2.2) Choose Web Page from the Save as type drop-down list;
2.3) Click the Save button.

3. In the popping up Microsoft Excel dialog box, click the Yes button.

4. Open the folder where the exported les are saved and you can see a folder and a HTML format le listed inside. All pictures in the workbook including charts,
shapes or objects are saved in this folder.

5. You can keep the pictures you need in the folder and delete others you don’t need

Easily export All Images At Once From Excel With an amazing tool

The above method will extract all objects from the workbook, maybe, some of them you don’t need. If you have Kutools for Excel installed in Excel, its Export Graphics
feature may help you save only the pictures you need.

After installing Kutools for Excel, please do as follows:

1. Click Kutools Plus > Import & Export > Export Graphics:

2. In the Export Graphics dialog box, please con gure as follows:

2.1) Choose Pictures from the Types drop down list;


Tips: By default, all graphics including charts, pictures and shapes in current workbook are listed.
2.2) In the Save directory section, click the button to select a folder to save your exported pictures;
2.3) In the Export format drop-down list, choose the type of image you want to export as;
2.4) Click OK.

3. Then a dialog box pops up to tell you how many pictures have been successfully exported, click the OK button.

Now you can go to the destination folder and check the exported images.

Please click Export Graphics to know more about this feature.

Before applying Kutools for Excel, please download and install it rstly.

Export images and rename them with the adjacent cell values

As shown in the screenshot below, there are two columns, one contains a list of fruit names and the other contains the corresponding pictures of the fruits. To export
these images and automatically name them with the corresponding fruit names, you can try the VBA code in this section.

1. In the worksheet where you want to export the pictures, press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. In the Microsoft Visual Basic for Applications window, click Insert > Module. And then copy the following VBA into the Module window.

VBA code: Export pictures in a column and name them automatically

1 Sub ExportImages_ExtendOffice()
2 'Updated by Extendoffice 20220308
3 Dim xStrPath As String
4 Dim xStrImgName As String
5 Dim xImg As Shape
6 Dim xObjChar As ChartObject
7 Dim xFD As FileDialog
8 Set xFD = Application.FileDialog(msoFileDialogFolderPicker)
9 xFD.Title = "Please select a folder to save the pictures" & " - ExtendOffice"
10 If xFD.Show = -1 Then
11 xStrPath = xFD.SelectedItems.Item(1) & "\"
12 Else
13 Exit Sub
14 End If
15
16 On Error Resume Next
17 For Each xImg In ActiveSheet.Shapes
18 If xImg.TopLeftCell.Column = 2 Then
19 xStrImgName = xImg.TopLeftCell.Offset(0, -1).Value
20 If xStrImgName <> "" Then
21 xImg.Select
22
23 Selection.Copy
24 Set xObjChar = ActiveSheet.ChartObjects.Add(0, 0, xImg.Width, xImg.Height)
25 With xObjChar
26 .Border.LineStyle = xlLineStyleNone
27 .Activate
28 ActiveChart.Paste
29 .Chart.Export xStrPath & xStrImgName & ".png"
30 .Delete
31 End With
32 End If
33 End If
34 Next
35 End Sub

Notes:

1) The number 2 in the line “If xImg.TopLeftCell.Column = 2 Then” represents the column number from which you want to export the pictures;
2) The number -1 in the line “xStrImgName = xImg.TopLeftCell.Offset(0, -1).Value” indicates that you will name the pictures with the values of the adjacent left
cells.

3. Press the F5 key to run the code. In the opening window, select a folder to save the pictures and then click OK.

Then all pictures in a speci ed column are exported and automatically named with the adjacent cell values as you speci ed.

Related article:

How to export charts to graphics in Excel?

Best Office Productivity Tools

Transform Hours into Minutes with Kutools for Excel!


Ready to supercharge your Excel tasks? Harness the power of Kutools for Excel - your ultimate time-saving tool. Streamline intricate tasks and glide through your data
like a pro. Experience Excel at lightning speed!

Why You Need Kutools for Excel

🛠 Over 300 Powerful Features: Kutools is packed with more than 300 advanced features, simplifying your work in over 1500 scenarios.

📈 Superior Data Processing: Merge cells, remove duplicates, and perform advanced data conversions – all without breaking a sweat!

⏱ Ef cient Batch Operations: Why put in extra effort when you can work smart? Import, export, combine, and tweak data in bulk with ease.

📊 Customizable Charts and Reports: Access a broad variety of additional charts and generate insightful reports that tell a story.

🗄 Powerful Navigation Pane: Gain an advantage with the robust Column Manager, Worksheet Manager, and Custom Favorites.

📝 Seven Types of Drop-down Lists: Make data entry a breeze with drop-down lists of various features and types.

🎓 User-Friendly: A breeze for beginners and a powerful tool for experts.

Download Now and Soar Through Time with Excel!

Read More... Free Download... Purchase...

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
Open and create multiple documents in new tabs of the same window, rather than in new windows.
Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

Read More... Free Download... Purchase...

Oldest First 

Comments 21      No ratings yet. Be the first to rate!

komal about 7 years ago · #15813

really helpful.. D thanks for such solutions.

Reply ·  0 ·  0

Kristin about 4 years ago · #26387

The Save As HTM feature is brilliant. One question, it duplicated all of my image files. Any idea why that would happen?

Reply ·  0 ·  0

shivamani about 4 years ago · #29933

Thanks really helpful.

Reply ·  0 ·  0

Tirtich about 4 years ago · #30465

thanks a lot it helped me a lot

Reply ·  0 ·  0

Tom about 1 year ago · #37729

This is great, if I wanted to grab the background colour of a cell (instead of an image) and save that as a image named with the adjacent cell how
would that be an easy change to the code?

Reply ·  0 ·  0

crystal  Tom about 1 year ago · #37730

Hi Tom,Do you mean saving the background color of the cell as an image and named it with the adjacent cell value?Sorry can't help you with
that.

Reply · Report ·  0 ·  0

Sophie about 1 year ago · #39520

Bonjour le code VBA m'enregistre des images blanches je ne comprends pas pourquoi. quelqu'un a une solution ?

Reply ·  0 ·  0

skyyang  Sophie about 1 year ago · #39570

Hello, Sophie,
The code in this article can work well in my Excel, could you upload your Excel file here if you don't mind? So we can help to check the problem
for you.
Or you can describe your problem more clear and detailed.
Thank you!

Reply · Report ·  0 ·  0

milan bojic  skyyang about 8 months ago · #42071

hallo skyyang, ich habe seit neulich das gleiche problem, viele leere *.png dateien.
Your text to link
bei jedem exportversuch werden andere bilder nicht richtig erfasst.
mfg und danke

Reply ·  0 ·  0

skyyang  milan bojic about 8 months ago · #42076

Hello, milan bojic


Which Excel version do you use?
I have tried the code in your workbook, it works well, and all the images in your workbook are exported in the folder and renamed
based on the cell value, see screenshot:

Reply · Report ·  0 ·  0

Milan Bojic  skyyang about 8 months ago · #42081

Hello skyyang, it's office 365. your code was working fine until 2 weeks ago, not anymore, see screenshot. meanwhile i found
something similar that works, (combined with yours), maybe you can use that for your code.

screenshot:
[img]https://drive.google.com/file/d/1vfRlhpyzqg7QNFeYl53mTvNON3gIrFwv/view?usp=sharing[/img]

1
2 Sub BilderExportieren()
3 Dim shaBild As Shape
4 Dim strZielpfad As String
5 strZielpfad = "c:\Tuerliste\img3\" '<== Zielpfad entsprechend anpassen!!
6 For Each shaBild In ActiveSheet.Shapes
7 BildExportShape shaBild, strZielpfad
8 Next shaBild
9 End Sub
10
11 Sub BildExportShape(shaBild As Shape, strZiel As String)
12 Dim xStrImgName As String
13 Dim chDiagramm As ChartObject
14 xStrImgName = shaBild.TopLeftCell.Offset(0, -1).Value
15 Application.ScreenUpdating = False
16 shaBild.CopyPicture Appearance:=xlScreen, Format:=xlPicture
17 Set chDiagramm = ActiveSheet.ChartObjects.Add(0, 0, shaBild.Width, shaBild.Height)
18 With chDiagramm.Chart
19 ' erforderlich bei Excel2010, da Diagrammfläche automatisch mit Rahmen erstellt wird
20 .Parent.ShapeRange.Line.Visible = msoFalse
21 ' bei Excel2016 muss die Diagrammfläche selektiert vor .Paste werden - andernfalls ist das Bild leer
22 If Val(Application.Version)
Val(Application Version) = 16 Then .ChartArea.Select
ChartArea Select

Thank you anyway


Milan Bojic

Reply ·  0 ·  0

skyyang  Milan Bojic about 8 months ago · #42235

Hello, milan bojic,


Thanks for your code, maybe it can help others in the future. 🙂

Report ·  0 ·  0

LITSA about 10 months ago · #40994

Τέλειο εργαλείο! Όμως το μέγεθος-ανάλυση της εικόνας μικραίνει . Υπάρχει τρόπος να διατηρηθεί η αρχική ανάλυση ?

Reply ·  0 ·  0

Dylan about 7 months ago · #42709

Hello, thank you for this article. When I execute the code above from Export images and rename them with the adjacent cell values, I get the
following error message: Run-time error '91' Object variable or With block variable not set. When I click debug, it highlights line 9 of the code. Do
you know why this is happening? FYI I am using Excel for Mac OSX. Thank you

Reply ·  0 ·  0

Dylan about 7 months ago · #42736

I am using the code given in the " Export images and rename them with the adjacent cell values" part of the article. When I run this code I get the
following error: "Run-time error '91' Object variable or With block variable not set."

When I click "debug" it points me to line 9 of the code :


xFD.Title = "Please select a folder to save the pictures" & " ExtendOffice"

Do you have a solution to this? Your article is the only solution I can find.

I am using Excel for Mac.

Reply ·  0 ·  0

skyyang  Dylan about 7 months ago · #42877

Hello, Dylan,

Sorry, our code is only applicable to Microsoft Excel, maybe you can try the code in Microsoft Excel.
Thank you!

Reply · Report ·  0 ·  0

Dylan  skyyang about 7 months ago · #42917

I am using Microsoft Excel on Mac OSX.

Reply ·  0 ·  0

joesanders95  Dylan about 5 months ago · #43244

I am also getting this issue using a Mac Dylan were you able to resolve?

Are we meant to change something with the below that it is picking up as a bug?

xFD.Title = "Please select a folder to save the pictures" & " ExtendOffice"

Reply · Report ·  0 ·  0

Mokamel about 7 months ago · #43048

Thank you for this great tool, It saved me a ton of time. But I've ran into an issue that most of the photos are saved as blank photos as shown in the
attached screenshot. Appreciate the help. Thank you

View Attachments 1 / 5

Reply · Report ·  0 ·  0

skyyang  Mokamel about 7 months ago · #43070

Hello, Mohamed
Did your problem occur when using Kutools for Excel? If so, could you upload your workbook file here if you don't mind?
So that, we can check where the problem is?
Thank you!

Reply · Report ·  0 ·  0

Milan Bojic about 7 months ago · #43078

fixed, thank you anyway:

1
2 Sub ExportImages_ExtendOffice()
3 'Updated by Extendoffice 20220308
4 Dim xStrPath As String
5 Dim xStrImgName As String
6 Dim xImg As Shape
7 Dim xObjChar As ChartObject
8 Dim xFD As FileDialog
9 Set xFD = Application.FileDialog(msoFileDialogFolderPicker)
10 xFD.Title = "Please select a folder to save the pictures" & " - ExtendOffice"
11 If xFD.Show = -1 Then
12 xStrPath = xFD.SelectedItems.Item(1) & "\"
13 Else
14 Exit Sub
15 End If
16
17 On Error Resume Next
18 For Each xImg In ActiveSheet.Shapes
19 If xImg.TopLeftCell.Column = 2 Then
20 xStrImgName = xImg.TopLeftCell.Offset(0, -1).Value
21 If xStrImgName <> "" Then
22 xImg Select

Reply ·  0 ·  0

Please leave your comments in English

Posting as Guest

Name Required) Email Required)

-
   “     
-

Pleae write your comment in English here...

Rate this post:      Reset 0 Characters

Submit Comment

Home Knowledge Support Forum Privacy Policy About Us

Follow Us Copyright © 2009 - 2023 www.extendof ce.com. | All rights reserved. Powered by ExtendOf ce. |  Sitemap
Microsoft and the Of ce logo are trademarks or registered trademarks of Microsoft Corporation in the United States
and/or other countries.

You might also like