Export to gif or jpg using excel

Posted on 2001-07-31
Last Modified: 2010-08-23
I know there is a way to export charts as pictures in excel
I wish to have a couple of lines in VBA
that does that.


Question by:oreghe
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
LVL 16

Accepted Solution

Richie_Simonetti earned 50 total points
ID: 6338579
Worksheets("Sheet1").ChartObjects(1) _
.Chart.Export _
    FileName:="current_sales.gif", FilterName:="GIF"

Author Comment

ID: 6420167
I have been away.
LVL 16

Expert Comment

ID: 6420231
No problem!, you are welcome anytime.
Thanks for the points/grade
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.


Expert Comment

ID: 33489883
When I try this solution, I get a:

Run-time error '1004':
Application-defined or object-defined error

Any ideas on a solution?
LVL 16

Expert Comment

ID: 33500929
well, that was a solution in Office97'Age i think.
Sure you are using at least a 2003, aren't you?

PD: anyway, just a guess, how many chart have you in worksheet?
LVL 16

Expert Comment

ID: 33501009
by the way, your sheet is named "sheet1"?
try replacing sheet1 for just 1

Expert Comment

ID: 33503096
I am using Excel 2003.  I have just one chart within a sheet. I tried renaming and am getting the same error.
LVL 16

Expert Comment

ID: 33503737
i did try with excel 2007 and it continues working!!
maybe, and just maybe, the error not belongs to that line of code... just a guess (without furter info i can speculate only)

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question