Take this code:
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, x, y, w, h).TextFrame .Parent.Line.Visible = False .Parent.Fill.ForeColor.RGB = RGB(r
You could try looking at CallByName, but I don't think it's going to do what you want (at least, not easily if you're going to want to evaluate multi-dot object/property references).
CallByName