Link to home
Start Free TrialLog in
Avatar of posconsultant
posconsultant

asked on

911! How do I get a reference to a radio button (Groupbox) object in excel spreadsheet macro?

Hi all,

    OK I am desperate now!  I am an OK Java and ASP developer, but in this project I am using JNI-COM bridge to MS Excel COM object excel9.olb I think.  Anyway, our client wants to use thei exisisting desktop excel spreadsheet app w/ macros with our java web app.  I have a GroupBox ("GroupBox14") on a Worksheet (Worksheet"AppData") which seems to be bound to the value of a range on another worksheet i.e Worksheet("Options").Range("A1B1").Value.  So if GroupBox14 has 3 radio buttons, "Small", "Medium", and "Large", the values 1,2,and 3 in A1B1 would respectively be small, medium and large.
     Are you with me so far?  OK, I am having a hard time setting the value of the radio buttons via setting the value in A1B1.  I want to get a reference to the GroupBox14 object and do soemthing like:
    Worksheet("AppData").GroupBox14.Value := 2
But I can't figure out the proper syntax within code editor or help menu.  I only have VB5 IDE installed, maybe I need VB6?  I searched MS site and Google but cant find syntax as Excel has some ambiguous stuff.
    How the heck can I do this?  I will give MAX points for any help!  Thanks!

 
Avatar of q2eddie
q2eddie
Flag of United States of America image

Hi, posconsultant.

You might be better off testing the values of the radio buttons within the group themselves.  Seems dumb, but I ran into the same problem that you did.  There does not seem to be a property on the shape itself to determine what the value was.

If Worksheet("AppData").OptionButton1.Value Then
  lcValue = "Small"
End If
If Worksheet("AppData").OptionButton2.Value Then
  lcValue = "Medium"
End If
If Worksheet("AppData").OptionButton3.Value Then
  lcValue = "Large"
End If

Leave this question open.  Perhaps, someone else will have a better suggestion.

Bye. -e2
ASKER CERTIFIED SOLUTION
Avatar of daffyduck14mil
daffyduck14mil

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of posconsultant
posconsultant

ASKER

Thanks to both!  I'll try your suggestions tomorrow at work.
Avatar of DanRollins
Hi posconsultant,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Split points between: q2eddie and daffyduck14mil

posconsultant, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Perhaps he has workdays that last 1 and a half year?

:)
late sleeper -;)
Per recommendation, force-accepted.

Netminder
CS Moderator

q2eddie: points for you at https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20328653