+ Reply to Thread
Results 1 to 4 of 4

how to access a value from excel option button using visual basic?

  1. #1
    henry
    Guest

    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. #2
    Forum Contributor
    Join Date
    02-15-2005
    Location
    Blackpool, UK
    Posts
    137
    xlformcontrol.xloptionbutton.VALUE ?????

    Art

  3. #3
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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




  4. #4
    Tushar Mehta
    Guest

    Re: 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 <[email protected]>,
    [email protected] 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1