Hi, I recorded a macro to format a rectangle as green outline and then put the letter 'B' and make that 'B' bold. The recording yielded the following code. When I went to run that same macro it got stuck on this line: With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 1).Font.Fill with the following error: vba error the index into the specific collection is out of bounds. I looked this error up and could not find a good solution for my specific problem - anyone have any ideas and while we're at it any way to make it more concise (in particular to get rid of .Select)? Thanks!
ActiveSheet.Shapes.Range(Array("Rectangle 1")).Select
With Selection.ShapeRange.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 102, 0)
.Transparency = 0
End With
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 1).Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 102, 0)
.Transparency = 0
.Solid
End With
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "B"
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 1). _
ParagraphFormat
.FirstLineIndent = 0
.Alignment = msoAlignCenter
End With
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 1).Font
.Bold = msoTrue
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(0, 102, 0)
.Fill.Transparency = 0
.Fill.Solid
.Size = 14
.Name = "+mn-lt"
End With
ActiveSheet.Shapes.Range(Array("Rectangle 1")).Select
With Selection.ShapeRange.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 102, 0)
.Transparency = 0
End With
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 1).Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 102, 0)
.Transparency = 0
.Solid
End With
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "B"
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 1). _
ParagraphFormat
.FirstLineIndent = 0
.Alignment = msoAlignCenter
End With
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 1).Font
.Bold = msoTrue
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(0, 102, 0)
.Fill.Transparency = 0
.Fill.Solid
.Size = 14
.Name = "+mn-lt"
End With