Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ric ric is offline
external usenet poster
 
Posts: 11
Default Exporting Graph

Hi again,

I'm having a problem exporting a graph to a defined location.

Sub cumulative_data()

Sheets("cum_data").Select
Start = 2
t1 = Sheets("cum_data").Cells(Start, 1).Value
t2 = Sheets("cum_data").Cells(Start, 2).Value
TheTitle = t2 & " " & "-" & " " & t1
Set MyRange = Range("C1:AM5")
MyRange.Select
Fname = "C:\" & t2 & _" & "cum" & ".gif"

Call Cum_data_graph

End Sub
Sub Cum_data_graph()
'
' This macro makes a line graph
'
<Snip bit that works that generates the graph

<heres the problem line
ActiveChart.Export Filename:=Fname, FilterName:="GIF"

Fname is defined in Sub cumulative_data() and stepping through code it
returns "C:\29H111_cum.gif" which is correct.

Now I was calling the graph at work in a different manner "Call
W075_Spend("C1:AM5", "Project Short Term Overall", "C:\overall.gif")" which
worked fine.

The problem seems to come from trying to define Fname in Sub
cumulative_data() and having it read it in Cum_data_graph().

Ric


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Exporting Graph

Hi ric,

You are correct, the scope of the variable means that although Fname is
correct in the cumulative_data routine it is an empty variable in the
Cum_data_graph routine.

You need to pass the variable like this,

Call Cum_data_graph(Fname)

and the Cum_data_graph routine need to be modified to accept an argument
like this,

Sub Cum_data_graph(Fname)

You might want to add the code,
Option Explicit

as the first line in your code module. This will require you to declare
all variables before the code will run.

Cheers
Andy

ric wrote:

Hi again,

I'm having a problem exporting a graph to a defined location.

Sub cumulative_data()

Sheets("cum_data").Select
Start = 2
t1 = Sheets("cum_data").Cells(Start, 1).Value
t2 = Sheets("cum_data").Cells(Start, 2).Value
TheTitle = t2 & " " & "-" & " " & t1
Set MyRange = Range("C1:AM5")
MyRange.Select
Fname = "C:\" & t2 & _" & "cum" & ".gif"

Call Cum_data_graph

End Sub
Sub Cum_data_graph()
'
' This macro makes a line graph
'
<Snip bit that works that generates the graph

<heres the problem line
ActiveChart.Export Filename:=Fname, FilterName:="GIF"

Fname is defined in Sub cumulative_data() and stepping through code it
returns "C:\29H111_cum.gif" which is correct.

Now I was calling the graph at work in a different manner "Call
W075_Spend("C1:AM5", "Project Short Term Overall", "C:\overall.gif")" which
worked fine.

The problem seems to come from trying to define Fname in Sub
cumulative_data() and having it read it in Cum_data_graph().

Ric



--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #3   Report Post  
Posted to microsoft.public.excel.programming
ric ric is offline
external usenet poster
 
Posts: 11
Default Exporting Graph

WAHAEY!!!

Cheers Andy, works a treat. I hope my Boss appreciates all you guys help as
much as I do.

Ric

"Andy Pope" wrote in message
...
Hi ric,

You are correct, the scope of the variable means that although Fname is
correct in the cumulative_data routine it is an empty variable in the
Cum_data_graph routine.

You need to pass the variable like this,

Call Cum_data_graph(Fname)

and the Cum_data_graph routine need to be modified to accept an argument
like this,

Sub Cum_data_graph(Fname)

You might want to add the code,
Option Explicit

as the first line in your code module. This will require you to declare
all variables before the code will run.

Cheers
Andy

ric wrote:

Hi again,

I'm having a problem exporting a graph to a defined location.

Sub cumulative_data()

Sheets("cum_data").Select
Start = 2
t1 = Sheets("cum_data").Cells(Start, 1).Value
t2 = Sheets("cum_data").Cells(Start, 2).Value
TheTitle = t2 & " " & "-" & " " & t1
Set MyRange = Range("C1:AM5")
MyRange.Select
Fname = "C:\" & t2 & _" & "cum" & ".gif"

Call Cum_data_graph

End Sub
Sub Cum_data_graph()
'
' This macro makes a line graph
'
<Snip bit that works that generates the graph

<heres the problem line
ActiveChart.Export Filename:=Fname, FilterName:="GIF"

Fname is defined in Sub cumulative_data() and stepping through code it
returns "C:\29H111_cum.gif" which is correct.

Now I was calling the graph at work in a different manner "Call
W075_Spend("C1:AM5", "Project Short Term Overall", "C:\overall.gif")"

which
worked fine.

The problem seems to come from trying to define Fname in Sub
cumulative_data() and having it read it in Cum_data_graph().

Ric



--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info



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 graph data daily as a line graph across a calendar format Glani Charts and Charting in Excel 3 November 23rd 07 09:05 AM
Exporting Excel Graph to PowerPoint or Flash REji Charts and Charting in Excel 0 September 3rd 07 12:54 PM
Exporting from Access to Excel issue - blank graph view Lisa Setting up and Configuration of Excel 0 March 13th 07 08:05 PM
Hyperlinkage of one graph with another graph or Drill down graph Sanjay Kumar Singh Charts and Charting in Excel 1 January 3rd 06 12:22 PM
exporting graph into a jpeg or bmp format Amjen1 Charts and Charting in Excel 1 September 21st 05 01:22 AM


All times are GMT +1. The time now is 06:43 AM.

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

About Us

"It's about Microsoft Excel"