Need help on Changing the Text of Option buttons!!!!

narra

New Member
Joined
Apr 26, 2005
Messages
17
Hi friends,

I have two option buttons with certain text for ex: "One", "Two". These two are inserted in a Group Box n Grouped.

Now option button 1. Text = One; Option button 2 .text = Two, Group box 3.

I grouped these three shapes. Finally the shape's name calles as Group 4.

In fact, I have two versions in the sheet one is french n second one is English. So i firstly named them in English. So i need to change the text in french when i click on "French" language button.

For ex : "One" to "Un", "Two" to "Deux". i used certain code change it? But it works only once n next time the Group Name changes. In dis case, "Group 4" to "Group 5"

I have almost 7 Groups in a sheet. How can i change the text? Help me, pls!!

thanks in advance,,
Narra.

My Code :

"Group 4" changes when we regroup...
:oops:
ActiveSheet.Shapes("Group 4").Select
Selection.ShapeRange.Ungroup.Select
ActiveSheet.Shapes("Option Button 1").Select
Selection.Characters.Text = "Un"
ActiveSheet.Shapes("Option Button 2").Select
Selection.Characters.Text = "Deux"
ActiveSheet.Shapes.Range(Array("Group Box 3", "Option Button 1", _
"Option Button 2")).Select
Selection.ShapeRange.Group.Select
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi Narra,
Here is an solution.

What I did was to give all buttons the caption I want in English, but I name them (property name) with the French name preceeded with XX,
So button with the text (caption) "One" will have the name XXUn
and button with the text (caption) "Two" will have the name XXDeux
etc so that buttons and controls that shouldn´t be translated have a name NOT starting with "XX"

The macro below is then started by pressing the button "French" which is a command button.

Private Sub btnFrench_Click()
Dim btn As Control
For Each btn In Me.Controls
If UCase(Left(btn.Name, 2)) = "XX" Then btn.Caption = Mid(btn.Name, 3)
Next btn
End Sub

If you have more buttons called "XXUn" then add an index and just let the "3" in
btn.Caption = Mid(btn.Name, 3)
reflect the number of digits you need in the index (4 for one digit index, 5 for two etc)

I hope this simple solution works for you,

Good Luck!
Jörgen

PS Make sure to save it with the English names
 
Upvote 0
You could try this;

I have a UserForm with 2 option buttons and 1 command button.

Insert a MODULE and declare an array to hold the option button names;

Code:
Public OptNames(10, 2) As String

Then use this code;

Code:
Private Sub CommandButton1_Click()
If CommandButton1.Caption = "Show FRENCH" Then
    OptionButton1.Caption = OptNames(1, 2)
    OptionButton2.Caption = OptNames(2, 2)
    CommandButton1.Caption = "Show ENGLISH"
Else
    OptionButton1.Caption = OptNames(1, 1)
    OptionButton2.Caption = OptNames(2, 1)
    CommandButton1.Caption = "Show FRENCH"

End If
End Sub


Private Sub UserForm_Activate()
OptNames(1, 1) = "One"
OptNames(2, 1) = "Two"
OptNames(1, 2) = "Un"
OptNames(2, 2) = "Deux"

End Sub

This will allow you to toggle the option button names between French & English by just clicking on the command button. You could also change the phrase "Show FRENCH" to the French equivalent so people who don't know english will know what it means.

cheers

Mark
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top