View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Edit text in a Command button

You didn't tell us how you wanted to change the text, but here is some code
that should get you started...

Sub ChangeCommandButtonCaption()
Dim Obj As Object
Dim WS As Worksheet
For Each WS In Worksheets
For Each Obj In WS.OLEObjects
If TypeOf Obj.Object Is CommandButton Then
Obj.Object.Caption = Obj.Object.Caption & " - 123"
End If
Next
Next
End Sub

The code in the If..Then block simply concatenates " - 123" on to the end
every CommandButton caption in the active workbook; obviously you would
change the code in the If..Then block to do whatever it is you wanted it to
do.

--
Rick (MVP - Excel)


"tkincaid" wrote in message
...
I used commandbutton from the control toolbar toolbox, I want to edit the
text on the button, the problem is I have over 500 sheets to do this to,
can
I run a macro to complete this task.