PC Review


Reply
Thread Tools Rate Thread

How to save a graph as jpg file in Excel 2007

 
 
Athena
Guest
Posts: n/a
 
      14th May 2008
Hello,

I need to save some Excel Graphs as jpg files. How can I do it?

Thank you.

Athena
 
Reply With Quote
 
 
 
 
Andy Pope
Guest
Posts: n/a
 
      14th May 2008
Hi,

Requires code. Syntax: Activechart.Export <filename> , <filtertype>

You can use this in the immediate window,(ALT+F11 CTRL+G)

Activechart.export "C:\mychart.jpg"

Cheers
Andy

Athena wrote:
> Hello,
>
> I need to save some Excel Graphs as jpg files. How can I do it?
>
> Thank you.
>
> Athena


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
 
Reply With Quote
 
 
 
 
Athena
Guest
Posts: n/a
 
      14th May 2008
Hello Andy,

Thank you very much. It worked. Do you happened to know how to set the
resolution of the jpeg image as well?

Athena

"Andy Pope" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> Requires code. Syntax: Activechart.Export <filename> , <filtertype>
>
> You can use this in the immediate window,(ALT+F11 CTRL+G)
>
> Activechart.export "C:\mychart.jpg"
>
> Cheers
> Andy
>
> Athena wrote:
>> Hello,
>>
>> I need to save some Excel Graphs as jpg files. How can I do it?
>>
>> Thank you.
>>
>> Athena

>
> --
>
> Andy Pope, Microsoft MVP - Excel
> http://www.andypope.info


 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      15th May 2008
There is no control over the resolution of the exported image. You get
whatever the resolution of the screen is.

By the way, JPG is really the wrong format for a chart. Most computer
graphics are better suited to PNG or GIF, which are also possible using the
Chart.Export method Andy provided. The JPG format was designed for
photographic images, which have areas of gradually changing colors and
shadows. JPG does poorly where there are sharp transitions of colors, for
example, along the edges of shapes and in text. For these situations, which
are what charts are made of, PNG is probably your best choice.

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


"Athena" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello Andy,
>
> Thank you very much. It worked. Do you happened to know how to set the
> resolution of the jpeg image as well?
>
> Athena
>
> "Andy Pope" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi,
>>
>> Requires code. Syntax: Activechart.Export <filename> , <filtertype>
>>
>> You can use this in the immediate window,(ALT+F11 CTRL+G)
>>
>> Activechart.export "C:\mychart.jpg"
>>
>> Cheers
>> Andy
>>
>> Athena wrote:
>>> Hello,
>>>
>>> I need to save some Excel Graphs as jpg files. How can I do it?
>>>
>>> Thank you.
>>>
>>> Athena

>>
>> --
>>
>> Andy Pope, Microsoft MVP - Excel
>> http://www.andypope.info

>



 
Reply With Quote
 
Athena
Guest
Posts: n/a
 
      16th May 2008
Jon,

Thank you. I did not know this.I shall try to save them as png files.

Athena

"Jon Peltier" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> There is no control over the resolution of the exported image. You get
> whatever the resolution of the screen is.
>
> By the way, JPG is really the wrong format for a chart. Most computer
> graphics are better suited to PNG or GIF, which are also possible using
> the Chart.Export method Andy provided. The JPG format was designed for
> photographic images, which have areas of gradually changing colors and
> shadows. JPG does poorly where there are sharp transitions of colors, for
> example, along the edges of shapes and in text. For these situations,
> which are what charts are made of, PNG is probably your best choice.
>
> - Jon
> -------
> Jon Peltier, Microsoft Excel MVP
> Tutorials and Custom Solutions
> Peltier Technical Services, Inc. - http://PeltierTech.com
> _______
>
>
> "Athena" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hello Andy,
>>
>> Thank you very much. It worked. Do you happened to know how to set the
>> resolution of the jpeg image as well?
>>
>> Athena
>>
>> "Andy Pope" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi,
>>>
>>> Requires code. Syntax: Activechart.Export <filename> , <filtertype>
>>>
>>> You can use this in the immediate window,(ALT+F11 CTRL+G)
>>>
>>> Activechart.export "C:\mychart.jpg"
>>>
>>> Cheers
>>> Andy
>>>
>>> Athena wrote:
>>>> Hello,
>>>>
>>>> I need to save some Excel Graphs as jpg files. How can I do it?
>>>>
>>>> Thank you.
>>>>
>>>> Athena
>>>
>>> --
>>>
>>> Andy Pope, Microsoft MVP - Excel
>>> http://www.andypope.info

>>

>
>


 
Reply With Quote
 
New Member
Join Date: Jul 2010
Posts: 1
 
      6th Jul 2010
Thank you Andy, i was looking for a solution too export graphs in PNG format, it work perfectly.

take care all.
 
Reply With Quote
 
New Member
Join Date: Apr 2011
Posts: 3
 
      2nd Apr 2011
Macro you can setup on the Toolbar to quickly export charts to a file in same directory as the workbook with filename same as the title of the chart.

Sub CopyChartToGIF()
'Take ActiveChart and copy it as a GIF image to the same directory as the Workbook is in and name it with the Chart_Title with spaces replaced with underscores.
Dim chtCopyChart As Chart, sCurrentDirectory As String, sFileName As String
Dim x As Integer, CellCharacter As String

Set chtCopyChart = ActiveChart
sCurrentDirectory = ActiveWorkbook.Path
sFileName = chtCopyChart.ChartTitle.Text

For x = 1 To Len(sFileName)
CellCharacter = Mid(sFileName, x, 1)
If CellCharacter Like "[</*\?%]" Then
sFileName = Replace(sFileName, CellCharacter, "_", 1) ', Replaces all illegal filename characters with "_"
End If
If Asc(CellCharacter) <= 32 Then
sFileName = Replace(sFileName, CellCharacter, "_", 1) ' Replaces all non printable characters with "_"
End If

Next

sFileName = sFileName & ".gif"
sFileName = sCurrentDirectory & "\" & sFileName

chtCopyChart.Export Filename:=sFileName, FilterName:="GIF"

MsgBox "Chart copied to " & sFileName, vbOKOnly, "Success!"


End Sub
 
Reply With Quote
 
New Member
Join Date: May 2011
Posts: 1
 
      6th May 2011
Is there a way to use rfengr's code and save the gif file not with the chart name, but the worksheet name instead?

This site is great, thanks so much!
 
Reply With Quote
 
New Member
Join Date: Apr 2011
Posts: 3
 
      6th May 2011
Bryang0906, here you go. Simply substitute ActiveSheet.Name to sFileName. Simple.

Sub CopyChartToGIF()
'Take ActiveChart and copy it as a GIF image to the same directory as the Workbook is in and name it with the Active Worksheet Name with spaces replaced with underscores.
Dim chtCopyChart As Chart, sCurrentDirectory As String, sFileName As String
Dim x As Integer, CellCharacter As String

Set chtCopyChart = ActiveChart
sCurrentDirectory = ActiveWorkbook.Path
sFileName = ActiveSheet.Name

For x = 1 To Len(sFileName)
CellCharacter = Mid(sFileName, x, 1)
If CellCharacter Like "[</*\?%]" Then
sFileName = Replace(sFileName, CellCharacter, "_", 1) ', Replaces all illegal filename characters with "_"
End If
If Asc(CellCharacter) <= 32 Then
sFileName = Replace(sFileName, CellCharacter, "_", 1) ' Replaces all non printable characters with "_"
End If

Next

sFileName = sFileName & ".gif"
sFileName = sCurrentDirectory & "\" & sFileName

chtCopyChart.Export Filename:=sFileName, FilterName:="GIF"

MsgBox "Chart copied to " & sFileName, vbOKOnly, "Success!"


End Sub
 
Reply With Quote
 
New Member
Dezy's Avatar
Join Date: May 2011
Location: Gujarat
Posts: 11
 
      10th May 2011
Quote:
Originally Posted by Athena View Post
Hello,

I need to save some Excel Graphs as jpg files. How can I do it?

Thank you.

Athena

After your chart has been prepared go to follow the steps to covert excel cahrt into jpg format
1. File > Save as > Select "Web Page (*.htm;*.html)
2.Choose Selection: Chart radio button
3. Click on Publish
4. Choose the destination where you want to save the chart by clciking on Browse
5. Again click on Publish
6. Then open the file you have saved (e.g. Chart.htm or Cahrt.html)
7. After opening the file right click on the chart and choose Save Image As
8. Then type the file name chart.jpg (in this you have to chnage the format by because by default it would be saved in gif format so you need to change it into jpg format so must save the file name with .jpg extension)
9. Click on save (please choose the destination where you want to save)
10. Now your excel chart is in jpf format
HOPE IT WOULD BE USEFUL . THANKS
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bar graph and stacked bar graph on same graph BRB Microsoft Excel Misc 3 22nd Aug 2008 07:26 PM
Nokia PC Suite on Laptop - nokia_error.jpg [0/3] - nokia_error2.jpg [0/2] - nokia_error2.jpg [0/2] - nokia_error2.jpg [0/2] Bob Moore Windows XP Help 1 22nd Feb 2006 01:50 PM
Nokia PC Suite on Laptop - nokia_error.jpg [0/3] - nokia_error2.jpg [0/2] - nokia_error2.jpg [0/2] Bob Moore Windows XP Help 0 22nd Feb 2006 01:28 PM
Hyperlinkage of one graph with another graph or Drill down graph =?Utf-8?B?U2FuamF5IEt1bWFyIFNpbmdo?= Microsoft Excel Charting 1 3rd Jan 2006 01:22 PM
I can't save images as jpg. I am only given bitmap as a choice to save pics off of web. Why can't I get the jpg option? =?Utf-8?B?Q2Ftcm9u?= Windows XP Photos 1 28th Apr 2004 10:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:10 AM.