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
  • 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Macro which automatically sends attachment to Outlook 14 78
VBA/SQL - Connect to SQL server and pull data 4 120
Visual Studio 2005 text editor 10 44
Problem to With line 4 63
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

820 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