ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Export a chart in a GIF file. Run-time error '1004': Application-defined or object-defined error; (https://www.excelbanter.com/excel-programming/397551-export-chart-gif-file-run-time-error-1004-application-defined-object-defined-error%3B.html)

[email protected]

Export a chart in a GIF file. Run-time error '1004': Application-defined or object-defined error;
 
Hi All,

I am new programing EXCEL makros and I am trying to export an EXCEL
chart as a GIF file. I am using the following code to do it:

Set CurrentChartX =
Sheets("1.Upright&TrackRodCoordinates").ChartObjec ts(1).Chart
CurrentChartX.Parent.Width = 306
CurrentChartX.Parent.Height = 180

Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChartX.Export Filename:=Fname, FilterName:="GIF"

I obtain the following error message in the last line:
Run-time error '1004': Application-defined or object-defined error;

I have tried the same code in other computers without problems.The
value of the pathname stored in Fname has been checked and seems
correct. I would appreciate any help...

Thank you,

Catherine


Jon Peltier

Export a chart in a GIF file. Run-time error '1004': Application-defined or object-defined error;
 
Does this work:

Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.png"
CurrentChartX.Export Filename:=Fname, FilterName:="PNG"

If so, there may be a problem with the GIF filter file. I had a similar
problem when I installed Excel 2007 on a computer alongside Excel 2003, then
removed Excel 2007. I don't recall the exact steps to fix it, but it may
have involved standing on my head under a full moon. Also copying the filter
files from a different computer and overwriting the ones that Office 2007
may have left behind.

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


wrote in message
oups.com...
Hi All,

I am new programing EXCEL makros and I am trying to export an EXCEL
chart as a GIF file. I am using the following code to do it:

Set CurrentChartX =
Sheets("1.Upright&TrackRodCoordinates").ChartObjec ts(1).Chart
CurrentChartX.Parent.Width = 306
CurrentChartX.Parent.Height = 180

Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChartX.Export Filename:=Fname, FilterName:="GIF"

I obtain the following error message in the last line:
Run-time error '1004': Application-defined or object-defined error;

I have tried the same code in other computers without problems.The
value of the pathname stored in Fname has been checked and seems
correct. I would appreciate any help...

Thank you,

Catherine




[email protected]

Export a chart in a GIF file. Run-time error '1004': Application-defined or object-defined error;
 
Thank you Jon,

I have changed the filter name as you have suggested. Unfortunatelly,
It hasn't solved the problem.

I am using Excel 2003, in case this information helps...

Do you have any other suggestion?

Thanks,

Cath


Peter T

Export a chart in a GIF file. Run-time error '1004': Application-defined or object-defined error;
 
Try omitting the optional FilterName argument altogether or pass an empty
string, eg

CurrentChartX.Export Filename:=Fname, FilterName:=""
or
CurrentChartX.Export Fname

Regards,
Peter T

wrote in message
oups.com...
Thank you Jon,

I have changed the filter name as you have suggested. Unfortunatelly,
It hasn't solved the problem.

I am using Excel 2003, in case this information helps...

Do you have any other suggestion?

Thanks,

Cath




[email protected]

Export a chart in a GIF file. Run-time error '1004': Application-defined or object-defined error;
 
Thank you Peter.

Unfortunatelly, it has not solved the problem. It could point towards
a problem with the path specified, but I have tried different existant
ones without success... Please, let me know if you have any other
idea.

Cath




All times are GMT +1. The time now is 12:17 PM.

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