自动创build并从一个列表中命名一个对象

我目前正在试图从引用列表中自动命名对象,而不是只在脚本中指定对象文本。

如何让脚本引用单独的工作表,称为“ Process Steps ,其中文本值位于单元格C7而不是在脚本中input语句,如Step 1

 ActiveSheet.Shapes.AddShape(msoShapeRectangle, 50, 50, 100, 50).Select Selection.Formula = "" Selection.ShapeRange.ShapeStyle = msoShapeStylePreset40 Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "Step1" 

彼得已经提到如何从另一个细胞中获取价值。 把这一点提前一点。

请避免使用。select.Select/.Activate INTERESTING READ

这是你正在尝试?

 Sub Sample() Dim shp As Shape Set shp = ActiveSheet.Shapes.AddShape(msoShapeRectangle, 50, 50, 100, 50) With shp.OLEFormat.Object .Formula = "" .ShapeRange.ShapeStyle = msoShapeStylePreset40 .ShapeRange(1).TextFrame2.TextRange.Characters.Text = _ ThisWorkbook.Sheets("Process Steps").Range("C7").Value End With End Sub