Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
chart over a shape | Charts and Charting in Excel | |||
Excel 2003: How to nudge a chart element or shape on a chart? | Charts and Charting in Excel | |||
check whether shape is a group | Excel Programming | |||
Shape ControlFormat.LinkedCell returns wrong Address for named range - BUG | Excel Programming | |||
Chart in a Shape | Excel Discussion (Misc queries) |