Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Edit text in a Command button

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Edit text in a Command button

Hi tkincaid

500 Worksheets or workbooks ?

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Edit text in a Command button

Hi,

Is there only one button on each of these 500 sheets? If there are more than
one how do we know which button to change the caption on?

Mike

"tkincaid" wrote:

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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Edit text in a Command button

Hi Guys,

Thanks for responding back. There are 500 worksheets in this workbook and
only two buttons on each sheet. However the contents on the spreadsheet is
changing and a quicker way to update this information is needed. I
appreciate your help.

"Mike H" wrote:

Hi,

Is there only one button on each of these 500 sheets? If there are more than
one how do we know which button to change the caption on?

Mike

"tkincaid" wrote:

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.

  #5   Report Post  
Posted to microsoft.public.excel.programming
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.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Edit text in a Command button

Hello Rick,

I tried your code and it didn't work for me. Here is my code that I need to
insert into a loop to make this happen on all of the 500+ worksheets:

'Instruction to change every button (identified as Button 3) in the workbook

ActiveSheet.Shapes("Button 3").Select
Selection.Characters.Text = "Another Facility"
With Selection.Characters(Start:=1, Length:=16).Font
..Name = "Arial"
..FontStyle = "Bold"
..Size = 12
..Strikethrough = False
..Superscript = False
..Subscript = False
..OutlineFont = False
..Shadow = False
..Underline = x1UnderlineStyleNone
..ColorIndex = 5
End With

I hope this helps, thanks.

"tkincaid" wrote:

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.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Edit text in a Command button

You said in your original message that your CommandButtons came from the
Control Toolbar Toolbox... if that is truly the case, then the default names
for the buttons would not have a space in them (that is, your button would
**not** be named "Button 3") and you would not be using the Shapes
collection to control them (as the code you posted indicates). The
CommandButtons from the Control Toolbar and the Buttons from the Forms
toolbar (where your button name indicates it comes from) are two completely
different entities and the method of controlling them through code is
completely different as well. So... which toolbar did you get the buttons
from (and, as an aside, did all the buttons come from the same toolbar)?

--
Rick (MVP - Excel)


"tkincaid" wrote in message
...
Hello Rick,

I tried your code and it didn't work for me. Here is my code that I need
to
insert into a loop to make this happen on all of the 500+ worksheets:

'Instruction to change every button (identified as Button 3) in the
workbook

ActiveSheet.Shapes("Button 3").Select
Selection.Characters.Text = "Another Facility"
With Selection.Characters(Start:=1, Length:=16).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = x1UnderlineStyleNone
.ColorIndex = 5
End With

I hope this helps, thanks.

"tkincaid" wrote:

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.


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Edit text in a Command button

Thanks for all your help

"Rick Rothstein" wrote:

You said in your original message that your CommandButtons came from the
Control Toolbar Toolbox... if that is truly the case, then the default names
for the buttons would not have a space in them (that is, your button would
**not** be named "Button 3") and you would not be using the Shapes
collection to control them (as the code you posted indicates). The
CommandButtons from the Control Toolbar and the Buttons from the Forms
toolbar (where your button name indicates it comes from) are two completely
different entities and the method of controlling them through code is
completely different as well. So... which toolbar did you get the buttons
from (and, as an aside, did all the buttons come from the same toolbar)?

--
Rick (MVP - Excel)


"tkincaid" wrote in message
...
Hello Rick,

I tried your code and it didn't work for me. Here is my code that I need
to
insert into a loop to make this happen on all of the 500+ worksheets:

'Instruction to change every button (identified as Button 3) in the
workbook

ActiveSheet.Shapes("Button 3").Select
Selection.Characters.Text = "Another Facility"
With Selection.Characters(Start:=1, Length:=16).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = x1UnderlineStyleNone
.ColorIndex = 5
End With

I hope this helps, thanks.

"tkincaid" wrote:

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.



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Edit text in a Command button

I was kind of expecting a different response. Is your problem solved?

--
Rick (MVP - Excel)


"tkincaid" wrote in message
...
Thanks for all your help

"Rick Rothstein" wrote:

You said in your original message that your CommandButtons came from the
Control Toolbar Toolbox... if that is truly the case, then the default
names
for the buttons would not have a space in them (that is, your button
would
**not** be named "Button 3") and you would not be using the Shapes
collection to control them (as the code you posted indicates). The
CommandButtons from the Control Toolbar and the Buttons from the Forms
toolbar (where your button name indicates it comes from) are two
completely
different entities and the method of controlling them through code is
completely different as well. So... which toolbar did you get the buttons
from (and, as an aside, did all the buttons come from the same toolbar)?

--
Rick (MVP - Excel)


"tkincaid" wrote in message
...
Hello Rick,

I tried your code and it didn't work for me. Here is my code that I
need
to
insert into a loop to make this happen on all of the 500+ worksheets:

'Instruction to change every button (identified as Button 3) in the
workbook

ActiveSheet.Shapes("Button 3").Select
Selection.Characters.Text = "Another Facility"
With Selection.Characters(Start:=1, Length:=16).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = x1UnderlineStyleNone
.ColorIndex = 5
End With

I hope this helps, thanks.

"tkincaid" wrote:

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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ho to edit text in a custom button donwb Excel Discussion (Misc queries) 3 September 20th 09 08:37 PM
Need to Add Text to Control Text Box via Command Button code BJ Excel Programming 1 September 19th 08 06:16 PM
edit command button jeana Excel Programming 3 March 21st 06 10:58 PM
using command button instead of edit function john tempest[_2_] Excel Programming 7 December 21st 05 06:41 PM
Edit Text in Button ianripping[_32_] Excel Programming 6 February 7th 04 11:37 AM


All times are GMT +1. The time now is 06:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"