PDA

View Full Version : VBA Internet Explorer Radio Button Help Needed



JMitchell83
03-24-2012, 04:17 PM
I have seen a couple of posts related to this and either I am doing something wrong (which is probably the case) or I am not understanding how this works.

Essentially I have some HTML Source for several radio buttons and need to select option 2.

Here is the relevant HTML source:
This is the form
<formname="myform" method="post" action="default_new.asp" onSubmit="return(false);">

<tdclass="medium" align="right" nowrapvalign="top"><b>Select Action: &nbsp;</b></td>

<inputtype="radio" name="TypeID" value="1" onclick="document.myform.Continue.value='';SubmitForm()">New Setup<br>
<Inputtype="radio" name="TypeID" value="2" onclick="document.myform.Continue.value='';SubmitForm()">Modify Setup<br>
<inputtype="radio" name="TypeID" value="3" onclick="document.myform.Continue.value='';SubmitForm()">Deactivate Setup<br>
<inputtype="radio" name="TypeID" value="4" onclick="document.myform.Continue.value='';SubmitForm()">Order Submission<br>


Here is an example of how I tried to get option 2 selected:

ie.Document.forms("myform").getElementById("TypeID")(2).Checked = True

I am probably missing missing something, but any assistance anyone could provide would be greatly appreciated.

Thanks!

Crocus Crow
03-27-2012, 05:33 AM
You haven't said how your code doesn't work. Does it compile? Does it produce a run-time error? Does it select the wrong option, etc.?

Maybe:
ie.Document.forms("myform").elements("TypeID")(1).Checked = True