View Single Post
  #1  
Old May 25th, 2010, 07:15 PM posted to microsoft.public.excel.charting
forRobertM
external usenet poster
 
Posts: 1
Default Callouts in 2007

Hello,
I have a VB6 app that launches Excel and generates charts. Currently
we use Excel 2003 but the company is finally adopting 2007. Parts of
the chart display as expected, but the callouts do not behave the
same. The following code works fine in 2003, but doesn't work in
2007. (The sub is called AddLegend even though it should be
AddCallout). There is also another code section where the callout is
positioned and the Shape.Adjustments are made to adjust the callout
line length etc.... The idea is that a chart could have multiple
lines on an X-Y Scatter plot and a callout per line would describe the
series.

Private Sub AddLegend(SeriesText As String)
Dim oNote As Excel.Shape
Dim oCallout As Excel.Shape
Dim lChartHeight As Long
Dim lChartWidth As Long

Set oCallout = mChart.Shapes.AddCallout(msoCalloutThree,
mChart.PlotArea.Width, mChart.PlotArea.Top,
UserControl.ScaleX(TextWidth(SeriesText), vbTwips, vbPoints) * 1.5,
UserControl.ScaleY(TextHeight(SeriesText), vbTwips, vbPoints))

With oCallout
.Visible = msoTrue

.Line.Visible = msoTrue
.Line.BeginArrowheadLength = msoArrowheadLong
.Line.BeginArrowheadStyle = msoArrowheadTriangle
.Line.BeginArrowheadWidth = msoArrowheadNarrow

.Callout.Gap = 0

.TextFrame.AutoSize = True
.TextFrame.Characters.Font.Size = 9
.TextFrame.Characters.Text = SeriesText
.TextFrame.AutoSize = False

.Callout.Border = (mBoxBorders = bbNotesAndLegend) 'msoTrue
.Left = mChart.PlotArea.Width - .Width
.Callout.Angle = msoCalloutAngle45
.Callout.AutoAttach = msoFalse


.Line.Style = msoLineSingle
.Line.Weight = 0.25
.Line.ForeColor.RGB = vbBlack
.TextFrame.Characters.Font.Color = vbBlack


End With
End Sub

The main issues are that auto sizing the textframe doesn't work, even
if I try to use TextFrame2, and
the .Callout.Angle = msoCalloutAngle45 line doesn't seem to do
anything.
The Shape.Adjustments don't work either, but I figured those out.
Their problem is that since I can't seem to set the angle to 45
degrees, the lines are all at different angles.

What I would really like is if someone could point me to a resource
along the lines of "you did this in 2003, do this in 2007 to get the
same results."

Thanks,
Robert