MacGyver7640
Board Regular
- Joined
- Oct 28, 2011
- Messages
- 76
Hi simple problem,
So I have this code for creating a text box in a chart, based on the values in a cell. But it doesn't seem to be making the changes to the margins I want (they come out as 0.0).
Does anyone know what the problem is with my code for the margins?
Thanks so much!
So I have this code for creating a text box in a chart, based on the values in a cell. But it doesn't seem to be making the changes to the margins I want (they come out as 0.0).
Does anyone know what the problem is with my code for the margins?
Thanks so much!
Code:
Sub AddATextbox()
With ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 190.75, 29, 57.75, 35)
.Name = "Event3"
.TextFrame.Characters.Text = Sheets("Sheet2").Range("F18")
.TextFrame2.AutoSize = msoAutoSizeShapeToFitText
.TextFrame2.MarginBottom = 0.1
.TextFrame2.MarginLeft = 0.1
.TextFrame2.MarginRight = 0.1
.TextFrame2.MarginTop = 0.1
.TextFrame.Characters.Font.Name = "Times New Roman"
.TextFrame.Characters.Font.Bold = True
.TextFrame.Characters.Font.Size = 6
'What does this do? compared to alignment below?
.TextEffect.Alignment = msoTextEffectAlignmentCentered
End With
'Selects the newly created textbox "Event3" and places it towards the right
ActiveChart.Shapes("Event3").Select
With Selection
.ShapeRange.Line.Weight = 0.75
.ShapeRange.Line.DashStyle = msoLineSolid
.ShapeRange.Line.Style = msoLineSingle
.VerticalAlignment = xlCenter
'Not sure what these codes do...copied this section from another. Save for future textbox.
'What does # do?
' .HorizontalAlignment = xlCenter
' .ShapeRange.Height = 10#
' .ShapeRange.Width = 45#
End With
End Sub