Excel Range to JPG

  • Thread starter Thread starter Funky Junky
  • Start date Start date
F

Funky Junky

I have been using the rng2gif.xla add-in for some time now for
creating images in excel.

However it puts a border around the image and you have to crop 0.25cm
from each edge to get the required picture without the border.

Does anybody know how to either:

1. Create a jpg image from a range of cells without a border; or
2. Automate Microsoft Photo Editor to crop the 0.25cm from the jpg
image using excel/VBA.

TIA
 
The rng2gif addin works by pasting a picture of the range into a chart,
and exporting the chart. This puts the border you don't want, and I
don't know how to get around it.

Photo Editor doesn't have a VBA interface that Excel VBA can manipulate,
but it's possible to use SendKeys. I used to have to use SendKeys to
automate Photo Editor, and believe me, it wasn't pretty, although it did
work.

As an aside, a GIF would be much better to render a worksheet range
(most charts also) than a JPG. GIFs work well for images with relatively
few colors and sharp transitions between colors. JPGs work best for
images with continuous gradients of many colors, with diffuse boundaries
between colors, like photographs. Whenever you see an image with lines
and text, in which the lines and text are diffuse and distorted, it's
because someone used JPG at too low a picture quality (and sometimes 99%
is too low for these features).

- Jon
 
Funky,
Not sure about MS Photo editor, but you can crop imgaes in Excel/VBA with:

Selection.ShapeRange.PictureFormat.CropRight = 27#

Also, you can script Adobe Photoshop if you have it.

NickHK
 
This doesn't change the image itself, it just hides the amount of the
image which is visible. Change the CropRight back to 0 and the entire
original picture is back.

This is fine if you're keeping the picture in Excel, but if it's going
to be exported for a web site, for instance, it will not work.

- Jon
 

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

Back
Top