Discarding unused parts of cropped pictures programmatically

Started by meredi, August 22, 2008, 03:17:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

meredi

Does anyone know how to crop a picture in Visio using VBA?

(I'm using 2003 if it makes a difference.)

I've searched the help files and can't find anything. I'm looking essentially for the equivalent of right clicking an image, going to Format -> Picture, the Compression tab, and then checking off "Delete cropped areas of pictures". I tried recording this behaviour with the Macro Recorder, but all I got was an empty macro, which makes me fear this simply isn't possible.

I'm trying to figure this out because I just realized that even though this command sounds like it's working on all the images in your doc, it actually only works on the one you've right-clicked. I'd like to make a macro that iterates through a whole doc and discards extra info from ALL the pictures. (My files get BIG -- anything to save space -- and time -- would be a miracle.)

Thanks for any input.

Visio Guy

Hi Meredi,

You can crop by setting cells in the ShapeSheet. Look at the section: Foreign Image Info.

This article describes how to get the crop-cells to do your bidding: Visio Film Strip Shapes: Hurray for Hollywood!

Of course, you can programmatically set the cells using VBA!
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

meredi

VisioGuy, I just reread my post and realized I didn't quite ask for the right thing (gotta love Friday, sigh) -- rather than how to crop programmatically, I'm looking for how to discard extra info from the cropped photo programmatically. Have you ever done such a thing? i.e. After I've cropped a bunch of images (which I'll do manually) I want to delete unused portions of the pics with a macro.

Since it's not really a "state", more of an action, I'd expect this isn't doable in the shapesheet?

Sorry for the confusion.