Can a a chart be saved as a .bmp?

F

Fan924

I can save charts as a .gif, as a .jpg and as a .png. How about
a .bmp? I have read that it is possible but no one is saying how. I
don' want to use print screan and then crop it. I am currently using
this below. Can it be modified for .bmp (24 bit color)? I am pretty
sure the answer is no but I wanted to consult the experts. Excel 97 &
2000.

Sub Chart_800x600Gif()
Dim MyChart As Chart
Set MyChart = ActiveChart
MyChart.Parent.Width = 600 ' resize the chart *.75
MyChart.Parent.Height = 450 ' actual size 800x600
MyDirectory = Left(ActiveWorkbook.FullName, Len
(ActiveWorkbook.FullName) - Len(ActiveWorkbook.Name))
MyChart.Export FileName:=MyDirectory & "Pics\" & ActiveChart.Name
& ".gif", Filtername:="gif"
End Sub
 
P

pshepard

Hi Fan924,

This works for me:

Sub Chart_800x600BMP()
Dim MyChart As Chart
Set MyChart = ActiveChart
MyChart.Parent.Width = 600 ' resize the chart *.75
MyChart.Parent.Height = 450 ' actual size 800x600
MyDirectory = Left(ActiveWorkbook.FullName, Len(ActiveWorkbook.FullName)
- _Len(ActiveWorkbook.Name))
MyChart.Export Filename:=MyDirectory & "\Pics\" & ActiveChart.Name &
".bmp", Filtername:="BMP"
End Sub
 
F

Fan924

I can not get it to work. I get an error on the line starting
"MyChart.Export". What version of excel are you using?
 
P

pshepard

Hi Fan924,

I have Excel 2007. I had to make a folder called Pics first in order for it
to work.

There should be a total of 8 lines of code for the macro.

There is an underscore in the code to indicate that the line is broken, the
lines before and after the underscore should be on the same line - delete the
underscore character.

If that still doesn't work - I can send you the file if you send me your
email address. If you are on Excel 2003 - I can save the file as that version
too.

Thanks,
Peggy
 
F

Fan924

Did not see yours when I posted. I did put everuthong on one line when
I first tried it. It must be a version problem. I am using excel 97.
 

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