ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Exporting Chart sheets as gifs (https://www.excelbanter.com/excel-programming/419711-exporting-chart-sheets-gifs.html)

John G

Exporting Chart sheets as gifs
 
I have this code and it works but creates two gifs for each chart sheet in my
workbook. For example: One gif has the following correct name but no gif:

1BUS-GDP-Graph.gif

Second gif file of the same chart, wrong name (old dos?) but contains the gif:

1BUS-G~1.GIF

Sub Chartexporter()
Dim Cht As Chart
Dim Fname As String
For Each Cht In ActiveWorkbook.Charts
Fname = ThisWorkbook.Path & "\" & Cht.Name & ".gif"
Cht.Export Filename:=Fname, Filtername:="gif"
Next Cht
End Sub


Nigel[_2_]

Exporting Chart sheets as gifs
 
Not sure what you want, but the first line of file creation does not create
a gif, saving a file by changing its extension is not going to work, all you
have done is save the workbook under a different extension name!

Cht.Export should work assuming that the FName is correctly formatted. But
I reckon the first lime create a files of the same name, hence the conflict.



--

Regards,
Nigel




"John G" <John
wrote in message
...
I have this code and it works but creates two gifs for each chart sheet in
my
workbook. For example: One gif has the following correct name but no gif:

1BUS-GDP-Graph.gif

Second gif file of the same chart, wrong name (old dos?) but contains the
gif:

1BUS-G~1.GIF

Sub Chartexporter()
Dim Cht As Chart
Dim Fname As String
For Each Cht In ActiveWorkbook.Charts
Fname = ThisWorkbook.Path & "\" & Cht.Name & ".gif"
Cht.Export Filename:=Fname, Filtername:="gif"
Next Cht
End Sub



John G[_2_]

Exporting Chart sheets as gifs
 
Hi Nigel,

I'm trying to loop through the workbook and export the chart sheets to gifs.

Thanks,

John

"Nigel" wrote:

Not sure what you want, but the first line of file creation does not create
a gif, saving a file by changing its extension is not going to work, all you
have done is save the workbook under a different extension name!

Cht.Export should work assuming that the FName is correctly formatted. But
I reckon the first lime create a files of the same name, hence the conflict.



--

Regards,
Nigel




"John G" <John
wrote in message
...
I have this code and it works but creates two gifs for each chart sheet in
my
workbook. For example: One gif has the following correct name but no gif:

1BUS-GDP-Graph.gif

Second gif file of the same chart, wrong name (old dos?) but contains the
gif:

1BUS-G~1.GIF

Sub Chartexporter()
Dim Cht As Chart
Dim Fname As String
For Each Cht In ActiveWorkbook.Charts
Fname = ThisWorkbook.Path & "\" & Cht.Name & ".gif"
Cht.Export Filename:=Fname, Filtername:="gif"
Next Cht
End Sub





All times are GMT +1. The time now is 01:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com