Class CalloutFormat (Excel VBA)
Contains properties and methods that apply to line callouts.
Properties
Accent allows the user to place a vertical accent bar to separate the callout text from the callout line.
Set myDocument = Worksheets(1)
With myDocument.Shapes
.AddShape msoShapeOval, 180, 200, 280, 130
With .AddCallout(msoCalloutTwo, 420, 170, 170, 40)
.TextFrame.Characters.Text = "My oval"
With .Callout
.Accent = msoTrue
.Border = False
End With
End With
End With
Angle returns or sets the angle of the callout line. If the callout line contains more than one line segment, this property returns or sets the angle of the segment that is farthest from the callout text box.
Set myDocument = Worksheets(1)
myDocument.Shapes("callout1").Callout.Angle = msoCalloutAngle90
AutoAttach true if the place where the callout line attaches to the callout text box changes depending on whether the origin of the callout line (where the callout points to) is to the left or right of the callout text box.
Set myDocument = Worksheets(1)
With myDocument.Shapes
With .AddCallout(msoCalloutTwo, 420, 170, 200, 50)
.TextFrame.Characters.Text = "auto-attached"
.Callout.AutoAttach = True
End With
With .AddCallout(msoCalloutTwo, 420, 350, 200, 50)
.TextFrame.Characters.Text = "not auto-attached"
.Callout.AutoAttach = False
End With
End With
AutoLength applies only to callouts whose lines consist of more than one segment (MsoCalloutType types msoCalloutThree and msoCalloutFour).
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Callout
If .AutoLength Then
.CustomLength 50
Else
.AutomaticLength
End If
End With
Border returns or sets an MsoTriState value that represents the visibility options for the border of the object.
Drop for callouts with an explicitly set drop value, this property returns the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box.
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Callout
If .DropType = msoCalloutDropCustom Then
If .Drop < .Parent.Height / 2 Then
.PresetDrop msoCalloutDropTop
Else
.PresetDrop msoCalloutDropBottom
End If
End If
End With
DropType returns a value that indicates where the callout line attaches to the callout text box.
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Callout
If .DropType = msoCalloutDropCustom Then
If .Drop < .Parent.Height / 2 Then
.PresetDrop msoCalloutDropTop
Else
.PresetDrop msoCalloutDropBottom
End If
End If
End With
Gap returns or sets the horizontal distance (in points) between the end of the callout line and the text bounding box.
Set myDocument = Worksheets(1)
myDocument.Shapes(1).Callout.Gap = 3
Length returns a Single value that represents the length (in points) of the first segment of the callout line (the segment attached to the text callout box).
Set myDocument = Worksheets(1)
With myDocument.Shapes
With .Item("callout1").Callout
If Not .AutoLength Then len1 = .Length
End With
If len1 Then .Item("callout2").Callout.CustomLength len1
End With
Parent returns the parent object for the specified object. Read-only.
Type returns or sets an MsoCalloutType value that represents the callout format type.