Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to access a value from excel option button using visual basic?

Hi,
my name is henry. I want to ask how to access a value in Excel option button
which is using xlformcontrol.xloptionbutton
which the value i want to show in textbox as information.

i've coding :
msgbox excel.xlformcontrol.xloptionbutton
and it displayed number 7 which the const of xloptionbutton
what i want is the value inside the optionbutton not the const.

does anyone know the answer?
thank's in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default how to access a value from excel option button using visual basic?

Msgbox Optionbutton1.Value

But it will show True or False, that is set or not.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"henry" wrote in message
m...
Hi,
my name is henry. I want to ask how to access a value in Excel option

button
which is using xlformcontrol.xloptionbutton
which the value i want to show in textbox as information.

i've coding :
msgbox excel.xlformcontrol.xloptionbutton
and it displayed number 7 which the const of xloptionbutton
what i want is the value inside the optionbutton not the const.

does anyone know the answer?
thank's in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default how to access a value from excel option button using visual basic?

Hi Henry,

What you are checking is just the value of the constant that XL uses to
identify the type of shape. For more search XL VBA help for
xlformcontrol and you will be led to the 'FormControlType Property'
page.

What you want to do is check the caption of the option button that the
user selected. Assuming you put multiple option buttons within a group
box in a worksheet, XL will ensure that only one of the option buttons
is selected at any given time. Then, you can use code like:

Dim i As Integer
With ActiveSheet
For i = 1 To .OptionButtons.Count
If .OptionButtons(i).Value = 1 Then
.Labels(1).Caption = .OptionButtons(i).Caption
End If
Next i
End With

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Hi,
my name is henry. I want to ask how to access a value in Excel option button
which is using xlformcontrol.xloptionbutton
which the value i want to show in textbox as information.

i've coding :
msgbox excel.xlformcontrol.xloptionbutton
and it displayed number 7 which the const of xloptionbutton
what i want is the value inside the optionbutton not the const.

does anyone know the answer?
thank's in advance

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
How do I access Visual Basic in Excel 2007 Trial? RandyS Setting up and Configuration of Excel 1 April 2nd 07 12:18 AM
Create and Use Button Menu using visual Basic in Excel Walter L. skinner Excel Discussion (Misc queries) 3 November 17th 05 11:40 AM
Activate check "Trust access to Visual Basic " in Excel Pablo via OfficeKB.com New Users to Excel 1 June 23rd 05 04:30 PM
This option(Trust access to visual basic project ) is not active . hesham Excel Programming 0 October 31st 04 01:29 PM
Stopping Excel after running visual basic in Access Bill McCaleb Excel Programming 4 April 4th 04 02:20 AM


All times are GMT +1. The time now is 07:47 AM.

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

About Us

"It's about Microsoft Excel"