Export Charts as JPG using 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", "test")

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
 
H

Harald Staff

Hi

ChartName seems like a variable ? If so then don't put quotes around it.

You need a .Chart in there too. Quote Excel VBA Help:
"This example exports chart one as a GIF file.

Worksheets("Sheet1").ChartObjects(1) _
..Chart.Export _
FileName:="current_sales.gif", FilterName:="GIF"HTH. Best wishes Harald
 
J

JP

Nevermind, I found it.

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

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

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