PDA

View Full Version : Solved: Covert excel pictures as a JPEGS



Shazam
10-16-2006, 05:36 PM
Hi everyone,

I have a excel picture that is link to cells. How can we modify this code below to go through all the worksheets in the workbook and covert those excel group objects as jpegs? I tried to put this code below but no luck.



Sub Test()

Dim shtTemp As Worksheet
Dim objShape As Shape

For Each shtTemp In ThisWorkbook.Worksheets
For Each objShape In shtTemp.Shapes
If objShape.Type = msoPicture Then
objShape.Cut
objShape.PasteSpecial Format:="Picture (JPEG)", Link:=False, _
DisplayAsIcon:=False
objShape.Range("E3").Select

End If
Next
Next
End Sub

mdmackillop
10-17-2006, 05:28 AM
Hi Shazam,
If you can't find a way to do this in VBA directly, have a look at Irfanview. A lot of command line options which may enable you to do this with a Shell command.
Regards
MD

Shazam
10-17-2006, 04:53 PM
Hi Shazam,
If you can't find a way to do this in VBA directly, have a look at Irfanview. A lot of command line options which may enable you to do this with a Shell command.
Regards
MD


Hi mdmackillop thank you for replying. Well I finally got it. But took me awhile to get it to work. This code below will loop through all your worksheets to find group objects and convert them into jpegs.

The reason why I need this code below because I'm going to export those jpegs onto powerpoint slides.



Sub convert_Into_JPEGS()

Application.ScreenUpdating = False
Dim sht As Worksheet
Dim shp As Shape

For Each sht In ActiveWorkbook.Sheets
For Each shp In sht.Shapes
sht.Activate
If shp.Type = msoGroup Then
shp.Cut

Range("B2").Select 'select the cell where you want to paste your image
sht.PasteSpecial Format:="Picture (JPEG)", Link:=False, _
DisplayAsIcon:=False
Exit For
End If
Next
Next
End Sub




mdmackillop

I have heard that term before Irfanview. Do you have a example or link I could learn more about it.?