VBA to compress photos in an excel worksheets

J

John

I need to write some VBA code, to compress several photos in my excel
worksheets. Is there anyone can help me? Thanks!
 
Joined
Oct 22, 2015
Messages
1
Reaction score
0
Hello guys,

I have been searching around for a code to compress photos and I don't want to be the bearer of the bad news but looks like MS Office didn't finish this part of excel since when you record a macro, the action on the button "Compress Pictures" under the Format tab doesn't record any string on a macro.

I had a file with 812 figures (it's a cattalogue) and I needed to reduce the file size since its weight was about 70mb, so i came up with this workaround that helped me to do the same but with a manual step in between.

What I did was:

1) Created a Macro to select all the shapes at once, with the code below:

Sub CompressingFigures()
Sheet1.Activate
ActiveSheet.Shapes.SelectAll
End Sub



2) After having all the 812 picutres selected I went to the tab PIcture Tools --> Format --> Compress Figures and selected manually the action



upload_2015-10-22_9-26-51.png




BTW the file went from 70mb to 15mb.


Hope this helps,

Rodolpho.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top