Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default export chart

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.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default export chart

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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
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.






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default export chart

Milos-

The " subscript out of range" error means the system can't find something
that is referenced in a collection index. In this case, the problem is the
reference in the workbooks collection. VBA requires the the complete file
name, including the extension.

The code should work if you use - Workbooks("SPCbook.xls").Sheets("SPC...
when you set the oSPChart object.

Stan Shoemaker
Palo Alto, CA

"Milos Setek" wrote:

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.







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i export a pivot chart as a static chart object? James Charts and Charting in Excel 2 November 11th 08 10:05 PM
Chart.Export images are shrinking as I export more images Jared Charts and Charting in Excel 3 January 29th 08 03:23 AM
export chart - what controls exported chart width Art Parra Excel Programming 2 December 6th 04 04:35 AM
export chart as jpg hke[_6_] Excel Programming 2 October 10th 04 06:10 AM
Export chart to .bmp Frank Kabel Excel Programming 1 August 12th 04 02:55 PM


All times are GMT +1. The time now is 10:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"