cgcamal
Active Member
- Joined
- May 2, 2007
- Messages
- 472
Hi everyone,
I have several "shapes" buttons (ActiveX control) in Sheet1 and I'm trying to replace each one of those buttons with
"normal" buttons (Userform control) using the same position (height, width, left, top), same Caption text of the existing
buttons, and assign all new buttons to the same "Macro1".
I'm trying with:
Because my code is not finished, I think is correct except parts in red. I don't know how to say that the current
control created take the caption of the current shape that will be deleted.
I hope someone could help me with this.
Thanks in advance.
Regards
I have several "shapes" buttons (ActiveX control) in Sheet1 and I'm trying to replace each one of those buttons with
"normal" buttons (Userform control) using the same position (height, width, left, top), same Caption text of the existing
buttons, and assign all new buttons to the same "Macro1".
I'm trying with:
Code:
Sub Change_Buttons_Type()
Dim Shps As Shape, sh As Integer
For Each Shps In ActiveSheet.Shapes
sh = sh + 1
With Shps
If .OLEFormat.Object.Name Like "CommandButton*" Then
ActiveSheet.Buttons.Add(.Left, .Top, .Width, .Height).OnAction = "Macro1"
ActiveSheet.Shapes.Range(Array([B][COLOR=Red]CurrentButton[/COLOR][COLOR=Red]Added[/COLOR][/B])).Characters.Text = [COLOR=Red][B].Caption
[/B][/COLOR]ActiveSheet.Shapes.Range(Array(.OLEFormat.Object.Name)).Delete
End If
End With
Next
End Sub
control created take the caption of the current shape that will be deleted.
I hope someone could help me with this.
Thanks in advance.
Regards
Last edited: