Is this what you are trying?
Set shp = ActiveSheet.Shapes(Selection.Name)
shp.Name = "Node" & Str(NumNodes)
With shp.OLEFormat.Object
.Object.Caption = "Node" & Str(NumNodes)
End With
FOLLOWUP
Just tried this and it works…
Public Sub Node_Button_Duication()
Dim shp As Shape
Dim NumNodes As Long
ActiveSheet.Shapes("CommandButton1").Select
Selection.Copy
Cells(5, 10 + 7 * (NumNodes - 1) - 1).Select
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft 47.25
Selection.ShapeRange.IncrementTop -13.5
NumNodes = 5
Set shp = ActiveSheet.Shapes(Selection.Name)
shp.Name = "Node" & Str(NumNodes)
With shp.OLEFormat.Object
.Object.Caption = "Node" & Str(NumNodes)
End With
End Sub
MORE FOLLOWUP
Try this
Set shp = ActiveSheet.Shapes(Selection.Name)
With shp.OLEFormat.Object
.Object.Caption = "Node" & Str(NumNodes)
.Name = "Node" & NumNodes
End With
Notice, I changed Str(NumNodes)
to NumNodes
?
The ActiveX Control Names cannot have spaces 🙂
Try now.
SNAPSHOT