Post an Article
Technology Category : Excel Macro
Extract Images from Excel Worksheet- Macro
By Vijay Kishore
Saves all the images embedded on the worksheet as a separate file in jpg format
[Total Vote(s) : 3 ] [Current Rating : 4 ] Rate this Article Low High


Download Source Code : Extract Images from Excel Worksheet - Macro.zip

Name of the Tool

Extract Images from Excel Worksheet- Macro

Brief Description of the Tool

Extract all the images embedded on the worksheet as a separate file in jpg format

Code Snippet

Sub PastePic_4mExcel()
Dim Images_all As Shape
Dim cntr As Integer
cntr = 1
For Each Images_all In ActiveSheet.Shapes
    ActiveWorkbook.Sheets("General Electric").Shapes(cntr).Select 'BottomRightCell.Select
    Selection.CopyPicture xlScreen, xlBitmap ' copy image to clipboard
    Shell "mspaint.exe", vbMinimizedFocus  'vbMaximizedFocus'Open Paint, wait two seconds while the application starts
    t = Timer:   Do Until Abs(t - Timer) > 2: Loop
    SendKeys "^(v)", False 'True 'Paste into Paint
    SendKeys "^(s)", True 'Show Save as dialog
    SendKeys "C:\Temp\test" & cntr & ".jpg", True 'Enter filename and press Enter
    SendKeys "{ENTER}", True 'Press Enter key
    SendKeys "%{F4}", True 'Quit Paint
    cntr = cntr + 1
Next Images_all
End Sub

Limitations

This macro works only with office XP.

About Vijay

Vijay
  • Name : Vijay
  • Email : vijay.kishore@gmail.com
  • Occupation : Software Engineer
  • Country : India  Country Flag
Top
Add Comment