I am attemping to create a textbox on a chart in an Excel worksheet. I can manage to create the rectangle and define the position, size, border, foreground fill colour and text so far, but I can’t seem to set the internal alignment or font size, weight, etc. Here is the code I have so far:
Lines ending with the following, do not work: ‘ DOES NOT WORK! Can someone please advise what I am doing wrong?
Thanks,
Drew
With Sheets("Rate Chart").Shapes.AddShape(msoShapeRectangle, 460, 270, 160, 30) .AutoSize = True ' DOES NOT WORK! .HorizontalAlignment = xlCenter ' DOES NOT WORK! .VerticalAlignment = xlCenter ' DOES NOT WORK! .Name = "RateBox" .TextFrame.Characters.Text = "Here is some test text" .Line.Visible = 0 .Fill.ForeColor.RGB = RGB(255, 255, 225) .TextFrame.Characters.Font = "Verdana" ' DOES NOT WORK! .TextFrame.TextRange.Text.Size = 14 ' DOES NOT WORK! .TextFrame.TextRange.Text.Bold = msoTrue ' DOES NOT WORK! .MarginBottom = 8 .MarginLeft = 10 .MarginRight = 10 .MarginTop = 8 End With