LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Check for named shape in chart

Hi,

If I have understood it correctly, there is no way to control the
placement of the Axis title object in a chart or control the text line
breaks in it through VB.

I'm building a code to apply user defined settings on charts and the
code adds a textbox in stead of using the Axis title so the placement
can be controlled and the user can control the line breaks.

The problem is: I the user applies one user defined chart and then
change to another, the text box is added again. I'm sure there is a
way to check if a named text box exist in a chart, and add it if it
doesn't. This is the current code:

Sub Column()
If Not ActiveChart Is Nothing Then
With ActiveChart.Parent
.Height = 252.75
.Width = 342.75
End With
ActiveChart.ApplyCustomType ChartType:=xlUserDefined, TypeName:= _
"Column"
ActiveChart.Legend.Left = 0
ActiveChart.Legend.Top = 250
ActiveChart.PlotArea.Left = 0
ActiveChart.PlotArea.Top = 25
ActiveChart.PlotArea.Height = 205
ActiveChart.PlotArea.Width = 340
ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, 0, 2,
0, 0).Select
Selection.Characters.Text = "Y-axis title"
With Selection.Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.ColorIndex = xlAutomatic
.Background = xlTransparent
End With
With Selection
.AutoScaleFont = False
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.ReadingOrder = xlContext
.Orientation = xlHorizontal
.AutoSize = True
.Placement = xlMove
.PrintObject = True
.Name = "Y-axis title"
End With
Else
MsgBox "You have to select a chart before performing this
action.", _
vbExclamation, "No chart selected."
End If
End Sub

Any help would be great!

--
Fredrik E. Nilsen
 
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
chart over a shape Laoballer Charts and Charting in Excel 1 January 30th 09 09:26 AM
Excel 2003: How to nudge a chart element or shape on a chart? Ted M H Charts and Charting in Excel 5 June 30th 08 07:08 PM
check whether shape is a group Claude Excel Programming 12 August 31st 06 01:03 PM
Shape ControlFormat.LinkedCell returns wrong Address for named range - BUG [email protected] Excel Programming 10 July 14th 06 03:05 PM
Chart in a Shape QPapillon Excel Discussion (Misc queries) 1 June 26th 06 04:17 PM


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