Thread: export chart
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Milos Setek Milos Setek is offline
external usenet poster
 
Posts: 12
Default export chart

Thanks for that Stan.

I did exactly as you suggested and I now get the following error:

Subscript out of range

All the relevant workbooks are open and the chart is present, so I don't
know what is going on.
Thanks once again, Milos.

"stanshoe" wrote in message
...
Here is the example from VBA Help.

Example
This example exports chart one as a GIF file.

Worksheets("Sheet1").ChartObjects(1) _
.Chart.Export _
FileName:="current_sales.gif", FilterName:="GIF"

It seems to be a syntax problem.

Stan Shoemaker
Palo Alto, CA

"Milos Setek" wrote:

Hello all,

I run some VBA code spawning it from vbscript. Several workbooks are

opened,
one of which has several sheets and one of these sheets has a chart in

it.
The sheet name with the chart is named SPC.
In the VBA code contained in ThisWorkbook I have the following code:

Dim oSPCchart

Set oSPCchart = Workbooks("SPCbook").Sheets("SPC").ChartObjects(1)
oSPCchart.Chart.Export "d:\Verification\test.gif", "GIF"


The error is:
Run-time error 1004
Application-defined or object-define error

I have tried other code variants but always get some type of 1004 error.
Does anyone have any tips?

Thanks in advance, Milos.