+ Reply to Thread
Results 1 to 22 of 22

How to determine Frame Text and option button caption value

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    How to determine Frame Text and option button caption value

    Hi, See enclosed file.

    I have several "frames" and in each "frame" are several radio option buttons.

    What i want to do is determine the following:
    For the radio button selected determine the frame and radio option button caption text.

    For example: The file currently has the 2nd frame "Database2" and radio option button "Desgin Example" selected. So i would like to know what vba code could be used to determine those two text values........"Database2" and "Design Example".

    Any ideas?

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to determine Frame Text and option button caption value

    What kind of frames? on a userform or a worksheet.
    If in a useform, code like this might work
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine Frame Text and option button caption value

    its not on a userform.....i think its on a worksheet.

    ---------- Post added at 03:02 PM ---------- Previous post was at 02:53 PM ----------

    i tried your code......getting a runtime error ...gives me invalide use of keyword "Me"

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to determine Frame Text and option button caption value

    ActiveX controls? My Mac doesn't support ActiveX, but as I recall, the properties are similar to those of userform controls.

    ----

    Me refers to the Useform. As a blind guess, try changing to ActiveSheet.

  5. #5
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine Frame Text and option button caption value

    i changed your code to the following


    Please Login or Register  to view this content.

    but when i try to run this i get an error at this ste




    Please Login or Register  to view this content.

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to determine Frame Text and option button caption value

    I don't know ActiveX controls. What error do you get? When you debug what does the immediate window give you for AControl.Name?

  7. #7
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How to determine Frame Text and option button caption value

    Hi welchs101, try it
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine Frame Text and option button caption value

    nilem,

    I tried your excel file and it worked.......but when i put your code into my file i get the correct "option button caption" but not the correct "frame text". see enclosed file.......not sure why the frame text does not work.........any ideas?
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine Frame Text and option button caption value

    so i think ......not sure........but instead of "frame text" i think what i am looking for is the groupbox text.........

  10. #10
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How to determine Frame Text and option button caption value

    two options, see the attachment

  11. #11
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine Frame Text and option button caption value

    hi nilem,

    thanks for you help. really appreaciated. I learned a few things. ONe thing i learned is that what i want to do i dont think can be done the way i was thinking.

    I have several "boxes" on a single worksheet. In each box there are several radio buttons. On the entire sheet the user can select only a single button...........the group name parameter in the properties window is the same for ALL the radio buttons on the sheet.........

    what i was hoping to do is capture the radio button text (which you showed me how to do) and the "box title text" which i dont think is possible from what i can tell.

    But thanks a lot for your help.

  12. #12
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How to determine Frame Text and option button caption value

    You can use an array of titles, something like
    box1 - Button1
    box1 - Button2
    box2 - button1
    box2 - Button2
    box2 - Button3 etc.
    Received the name of a button, you can get the name of box from the array.
    You can also try to use linked cells on a worksheet, or drop-down lists, or ... many options.

  13. #13
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How to determine Frame Text and option button caption value

    if you really want it with your layout (I think nilem's second option was better)
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  14. #14
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine Frame Text and option button caption value

    thanks nilem and joseph.

    joseph, i tried the code you sent.....it worked. Nilem thanks for your help as well. Both very much appreciated. I learned some stuff .......thanks.

  15. #15
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine Frame Text and option button caption value

    josephP,

    I reviewed your code.........to be honest i dotn understand it all......can you explain this code snipet.....

    Please Login or Register  to view this content.

    not sure i understand why this works.

  16. #16
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How to determine Frame Text and option button caption value

    translation-
    is the cell under the top left corner of the option button within the range of cells that the groupbox is over?

  17. #17
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine Frame Text and option button caption value

    hi josephP,

    how on earth did you ever think of this......i would have never thought of doing something like that........

    always something to learn i guess.

    so you can determine the cell under the option button........any good links on this?

  18. #18
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to determine Frame Text and option button caption value

    The ObjectBrower in the VB editor is a powerful aid.

  19. #19
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine Frame Text and option button caption value

    OK......its not working............i changed the layout and not my code does not work..........

    What is supposed to happen is that the user selects an option button. My code then retrieves the option button value and then determines what "Frame" or "group" this option button came from.

    My code is not retrievign the "Frame" or "group" name correctly. I had used some code that was working but i did not read the comments carefully enough.......it works for only a specific layout..............now for example if user selects (see enclosed file)the option button "Internal Trainings" under the "General activities" frame/group what is returned is
    Optionbutton value = Internal Trainings
    Caption/group name value = "Data Import/Export" which is the group name to the left.....


    Any ideas on how to either redo or fix this would be greatly appreaciated..........found this error out at a really bad time......guess murphy's law is in play.
    Attached Files Attached Files

  20. #20
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How to determine Frame Text and option button caption value

    you have overlap. the data import/export frame extends into column g (barely) so the top left cell of the option button (g25) is within the range specified by the top left cell of the frame (a20) and its bottom right cell (g28). you need to make sure there is no overlap

  21. #21
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine Frame Text and option button caption value

    joseph,

    So if i just keep the left most boxes limited to column F and then the right most boxes starting in col-g then things seem to work.....................

    THANKS!!!!!!!!!!!!!!!!!

    that seems to fix it...........

    you have no idea how thankful i am

  22. #22
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How to determine Frame Text and option button caption value

    you're welcome :-)

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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