Request Vba code Export gif file

L

Luigi

I have problem with code Excel-vba: I have this code

Private Sub make_Gif()
x = 22
For k = 1 To x
Dim mychart As Chart
Set mychart = Sheets("DATA").ChartObjects(k).Chart
mychart.Export Filename:="c:\" & k & ".gif", FilterName:="gif"
Next k
End Sub
This code is testing ok!
This code VBA, Export 22 charts to gif file format , named with number k (1-22)
c:\1.gif
c:\2.gif
c:\...
c:\22.gif
I want export this charts in c:\ChartTitle.Gif
c:\salesI.Gif
c:\salesII.Gif
c:\Integration.Gif
c:\.......
ChartTitle=Title of Chart



it's possible?

Plese help me
Thank for all!!

My e-mail: (e-mail address removed)
 
G

Guest

Luig

Tr
mychart.Export Filename:="c:\" & mychart.charttitle.text & ".gif", FilterName:="gif
Ton

----- Luigi wrote: ----

I have problem with code Excel-vba: I have this cod

Private Sub make_Gif(
x = 2
For k = 1 To
Dim mychart As Char
Set mychart = Sheets("DATA").ChartObjects(k).Char
mychart.Export Filename:="c:\" & k & ".gif", FilterName:="gif
Next
End Su
This code is testing ok
This code VBA, Export 22 charts to gif file format , named with number k (1-22
c:\1.gi
c:\2.gi
c:\..
c:\22.gi
I want export this charts in c:\ChartTitle.Gi
c:\salesI.Gi
c:\salesII.Gi
c:\Integration.Gi
c:\......
ChartTitle=Title of Char



it's possible

Plese help m
Thank for all!

My e-mail: (e-mail address removed)
 
W

Wouter HM

Ho Luigi,

This should do the trick:

Private Sub make_Gif()
Dim k As Integer
Dim t As String
Dim mychart As Chart

For k = 1 To Sheets("blad1").ChartObjects.Count
Set mychart = Sheets("blad1").ChartObjects(k).Chart
t = mychart.ChartTitle.Caption
mychart.Export Filename:="c:\" & t & ".gif", FilterName:="gif"
Next k
End Sub


Good Luck

Wouter HM
 
L

Luigi

This cosde Vba is ok!

mychart.Export Filename:="c:\" & mychart.charttitle.text & ".gif",
FilterName:="gif"

Thank very much, Tony
 

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