thenelson
asked on
select radio button in webbrowser control using vba
I have a webpage with the following code:
What is the correct code to do this?
I have successfully filled input boxes on the page with code like:
These create the error "object doesn't support the property:
<label><input type="radio" name="patient_gender" value="patient_gender_m" id="patient_gender_value_patient_gender_m" />Male</label>
<label><input type="radio" name="patient_gender" value="patient_gender_f" id="patient_gender_value_patient_gender_f" />Female</label>
I would like to select the male or female radio button as appropriate.What is the correct code to do this?
I have successfully filled input boxes on the page with code like:
Me.ocxWebBrowser.Document.Forms(0).patient_fname.Value = "Nelson"
These create the error "object doesn't support the property:
Me.ocxWebBrowser.Document.Forms(0).patient_gender_value_patient_gender_m.checked=true
Me.ocxWebBrowser.Document.Forms(0).patient_gender_value_patient_gender_m.click
ASKER
Me.ocxWebBrowser.Document. All.patien t_gender_v alue_patie nt_gender_ m.checked= check
produces "object doesn't support this property"
produces "object doesn't support this property"
I was hopping this will work:
Me.ocxWebBrowser.Document. All.patien t_gender_v alue_patie nt_gender_ m.checked
with no = True
Me.ocxWebBrowser.Document.
with no = True
ASKER
Me.ocxWebBrowser.Document. All.patien t_gender_v alue_patie nt_gender_ m.checked
produces "object doesn't support this property"
not sure what you mean by:
with no = True
produces "object doesn't support this property"
not sure what you mean by:
with no = True
ASKER
I found my problem. The correct syntax is:
Me.ocxWebBrowser.Document. Forms(0).p atient_gen der_value_ patient_ge nder_m.Cli ck
but the webpage I am trying to interface with changes the name of the gender radio button depending upon which form is called up. I some cases it is:
patient_gender_value_patie nt_gender_ m
while other forms (for the same page), its:
gender_value_gender_m
The other field id's remain the same between the forms.
Me.ocxWebBrowser.Document.
but the webpage I am trying to interface with changes the name of the gender radio button depending upon which form is called up. I some cases it is:
patient_gender_value_patie
while other forms (for the same page), its:
gender_value_gender_m
The other field id's remain the same between the forms.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, the Click property is used. I was running into problems because the website pulls up different forms for different insurance companies. Although the ID's for the textboxes stay the same from form to form, the gender radio buttons ID's change for different forms. So sometimes the Click property worked and sometimes it didn't.
Thanks for your input.
Thanks for your input.
You are welcome. Thank you for the points.
Also for the record, I called event while I should have said method.
I wonder if it will work with () like:
Me.ocxWebBrowser.Document. Forms(0).p atient_gen der_value_ patient_ge nder_m.Cli ck()
Also for the record, I called event while I should have said method.
I wonder if it will work with () like:
Me.ocxWebBrowser.Document.
i am looking for exact syntax now.