How to export all images at once from Excel_
How to export all images at once from Excel_
ExtendOf
ExtendOf ce
ce Products Download Purchase Resources Support Search
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.
Ok
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.
1. Click Kutools Plus > Import & Export > Export Graphics:
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.
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.
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:
🛠 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.
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!
Oldest First
Reply · 0 · 0
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
Reply · 0 · 0
Reply · 0 · 0
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
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
Bonjour le code VBA m'enregistre des images blanches je ne comprends pas pourquoi. quelqu'un a une solution ?
Reply · 0 · 0
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
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
Reply · Report · 0 · 0
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
Reply · 0 · 0
Report · 0 · 0
Τέλειο εργαλείο! Όμως το μέγεθος-ανάλυση της εικόνας μικραίνει . Υπάρχει τρόπος να διατηρηθεί η αρχική ανάλυση ?
Reply · 0 · 0
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
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."
Do you have a solution to this? Your article is the only solution I can find.
Reply · 0 · 0
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
Reply · 0 · 0
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
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
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
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
Posting as Guest
-
“
-
Submit Comment
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.