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

I used to use the following code to activate a chart called
"LoadGraph"

ActiveSheet.ChartObjects("LoadGraph").Activate
ActiveChart.ChartArea.Select

What I can not figure out is. How I gave it the name?

It was useful when wanting to edit an existing chart to change
it's options and layout.

Another question would be.... at what point in the chart creation
can I give it the name? By default Excel uses Chart Area, but I
can not get it to activate the chart.

-Randy-


  #2   Report Post  
Posted to microsoft.public.excel.programming
COM COM is offline
external usenet poster
 
Posts: 40
Default Naming Chart

The only thing that I saw that was possible to name your chart, was.. After creating the chart, either programmatically with VBA, or by hand, that you went into the VBA editor and gave the chart object a name. Like the following

I created a chart on Sheet1
Then in the immediate window, I typed the following
Sheet1.ChartObject(1).Name = "ThisChart

Now, anytime I referenced Sheet1.ChartObject("ThisChart") I got the response(s) I expected when dealing with a Chart Object

Of course I would have to save the file for this renaming to remain, but that's up to you. :) I have no need for it

Does that make sense

If you created the chart using VBA code, you could or could have created the chart and given it a name at that time, and could continue to use that chart by name in the future.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Naming Chart


Hey, thanks for the try but that did not
work for me. I tried placing it in a number
of places in the code that creates and adjusts
the chart and the code stops there each time.

I have tried the following as well with the
same results:

Selection.Name = "MyChartNameForRecall"

Any other suggestion? -Randy-


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Naming Chart

Randy -

You can name a chart this way:

Manually - Existing Chart:
Select a cell. Hold Shift or Ctrl while clicking on the chart. The
chart has white handles, not black (handles are those little squares on
the corners and midpoints of the edges). Click in the Name Box (above
the top left visible cell, to the left of the Formula Bar), where it
probably says something like "Chart 3", and type whatever name you want,
and press Enter.

VBA - Active Chart:
ActiveChart.Parent.Name = "Name of this Chart"

VBA - Any Existing Chart:
ActiveSheet.ChartObjects(3) = "Name of this Chart"

VBA - While Creating a New Chart:
If you're adding a chart (sheet) then locating it on a worksheet:

Charts.Add
ActiveChart.ChartType = xlXYScatterLines
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A3:G14")
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"
ActiveChart.Parent.Name = "Name of this Chart"

If you're adding an embedded chart to a worksheet:

With ActiveSheet.ChartObjects.Add _
(Left:=100, Width:=375, Top:=75, Height:=225)
With .Chart
.ChartType = xlXYScatterLines
.SetSourceData Source:=Sheets("Sheet1").Range("A3:G14")
.Parent.Name = "Name of this Chart"
End With
End With

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
http://PeltierTech.com/Excel/Charts/
_______

Randal W. Hozeski wrote:

I used to use the following code to activate a chart called
"LoadGraph"

ActiveSheet.ChartObjects("LoadGraph").Activate
ActiveChart.ChartArea.Select

What I can not figure out is. How I gave it the name?

It was useful when wanting to edit an existing chart to change
it's options and layout.

Another question would be.... at what point in the chart creation
can I give it the name? By default Excel uses Chart Area, but I
can not get it to activate the chart.

-Randy-



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Naming Chart

WOOW!! Now that worked, and then some.
It was the .Parent that I was not putting
in. Thanks -Randy-



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Naming a chart object Jeff M Charts and Charting in Excel 6 September 23rd 08 06:00 AM
Chart Axis naming question SK Charts and Charting in Excel 1 May 12th 06 08:39 PM
Naming a Chart William Bartusek Excel Discussion (Misc queries) 2 March 16th 05 11:22 PM
Naming Chart Tom Ogilvy Excel Programming 0 July 15th 03 05:16 PM
Naming Chart pancho[_5_] Excel Programming 0 July 15th 03 04:47 PM


All times are GMT +1. The time now is 11:55 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"