Export Chart to JPG in VB.NET

J

JP

Hi,
I tried searching this group and others to find a way to export a chart from
excel using vb.net but I can't seem to find any solution. I'm trying to
avoid using VBA.

I'm trying:

xlsheet.ChartObjects("ChartName").Export("test.jpg", "jpg")

but that doesn't seem to be working. The export method doesn't seem to
work.

I get this error:
"Public member 'Export' on type 'ChartObject' not found."

Any help would be great.

Thanks,
JP
 
J

JP

Nevermind, I found it.

Wrong:
xlsheet.ChartObjects("ChartName").Export("test.jpg", "jpg")

Correct:
xlsheet.ChartObjects("ChartName").Chart.Export("test.jpg", "jpg")
 
J

Jon Peltier

You'll probably never check back, but here's a suggestion. Use GIF or PNG as your
image file format, not JPG. The JPG compression was designed for photographic-type
images, with continuously varying shades of color. When a JPG image has sharp
transitions, especially between text and the background, you get a certain ugly
fuzziness that makes the image look unprofessional. GIFs and PNGs are designed for
images with sharp transitions between a relatively smaller number of colors. Line
drawings and charts are good candidates for GIFs and PNGs.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
J

JP

Thanks for the suggestion. I did end up using GIF format and it also gives
a smaller file size.
 

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