Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The reason you cannot use the chart name is that it changes when you use
the .Location method. The code below should give you an indication of what happens. Step (2) uses the fact that your chart MUST be the last created chartobject to set the reference WITHOUT having to actually know it's name In step (3) you could add the Name:= parameter to force your chartsheet back to it's original name, just remember to check that there is not another sheet with the same name ---- Sean "Just press the off switch, and go to sleep!" '---------------------------------------------------- '---------------------------------------------------- Sub ChartNameChanging() Dim myChart As Chart, msg As String ' (1) start with a simple chartsheet Set myChart = ActiveChart msg = msg & "Original Chartsheet = " & myChart.Name & vbCrLf ' (2) move it to an embedded object on a worksheet myChart.Location Whe=xlLocationAsObject, Name:="aulogbd" Set myChart = Worksheets("aulogbd").ChartObjects(Worksheets("aul ogbd").ChartObjects.Co unt).Chart msg = msg & "Now embedded chart = " & myChart.Name & vbCrLf ' (3) move it back to a chartsheet myChart.Location Whe=xlLocationAsNewSheet Set myChart = ActiveChart msg = msg & "Back to Chartsheet = " & myChart.Name & vbCrLf MsgBox (msg) Set myChart = Nothing End Sub '---------------------------------------------------- '---------------------------------------------------- *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
disconnected chart objects | Charts and Charting in Excel | |||
Grouping Objects in a Chart or Graph | Excel Discussion (Misc queries) | |||
How to Name Chart Objects | Excel Discussion (Misc queries) | |||
Chart objects | Excel Programming | |||
Moving Chart Objects | Excel Programming |