Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Changing the test of checkboxes (shapes) programmatically?

Dear all,

I've found a way to change the text *next to* a single checkbox on a worksheet with this code:

Sub change()
ActiveSheet.Shapes.Range(Array("Check Box 12")).Select
Selection.Characters.Text = "any_new_text"
End Sub

But If there are many textboxes in a file, on different worksheets, there must be a way to address them all in one go. I also managed to read the 'name' and 'alternative text' of shapes with this code:

Dim c As Shape
For Each c In Worksheets(1).Shapes
Debug.Print c.Name & " " & c.AlternativeText
Next c
End Sub

I guess there must be a way to change the text (which appears not to be the properties 'Name' or 'Alternativetext') of all shapes, but can't get my head around it. Anyone who can?

Regards,
Dr
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Changing the test of checkboxes (shapes) programmatically?

I'm afraid that doesn't work, because the texts *next to* the CheckBoxes (= shapes) are not msoTextBoxes, nor .Name, nor .AlternativeText. The texts I want to change are 'elements' of a Shapes.Range(Array("xxx")) object and can be selected with the .Select method, as can be seen in this working code snippet:

Sub change()
ActiveSheet.Shapes.Range(Array("Check Box 12")).Select
Selection.Characters.Text = "any_new_text"
End Sub

My purpose was to change all these 'elements' in one pass, but I don't know how to do that with VBA. I was thinking of a For... Next loop and would need som help to write that routine.

Kind regards
Dr



On 30-1-2013 15:50, Sheriff wrote:
If c.Type = msoTextBox Then
Debug.Print c.Name & " " & c.AlternativeText
End If




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
Help:Programmatically Adding Checkboxes with Captions [email protected] Excel Programming 2 April 19th 06 08:09 PM
Programmatically add shapes to a selection Edward Ulle Excel Programming 3 August 8th 05 12:17 AM
Programmatically add shapes to a selection Edward Ulle Excel Programming 0 June 1st 05 08:29 PM
Removing Checkboxes Programmatically Mark D'Agosta Excel Programming 4 October 21st 03 03:57 PM
Adding Checkboxes Programmatically Mark D'Agosta Excel Programming 1 October 8th 03 03:20 AM


All times are GMT +1. The time now is 02:41 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"