How to run website forms in Excel without using Sendkeys?

I am trying to fill out a form on a website using Excel VBA. I created InternetExplorer.Application, went to the page and looked at a bunch of data using If UserForm1.TC2.Value = True Thenor something like the like PostCode = objIE.document.getElementsByName("ProjectFile-ProposalAddress-PostCode")(0).Value.

After that, I go to the new page and want to fill it out using my previous data.

And here I ran into trouble. I want to check the "New permission" field, and its code:

<form id="document-form">
<div class="generate-form form-horizontal">
<div class="form-group"><label class="col-sm-3 control-label"><span>New Permit</span></label><div class="input col-sm-7">
<div class="checkbox">
<input type="checkbox" data-bind="checked: NewPermit" />
</div></div></div><div class="form-group"><label class="col-sm-3 control-label"><span>Staged Permit</span></label><div class="input col-sm-7">
<div class="checkbox">
    <input type="checkbox" data-bind="checked: StagedPermit" />
</div>

Who does not have a name to block. I'm not an HTML expert, but there is one more code that references this checkbox (I think)

 var model = {  "NewPermit": null,   "StagedPermit": null,  "AmendedPermit": null,

etc..

I skipped a loop through the code using .getElementsByTagName("Span")with various .tagNameetc. For the New Permit field, the following results:

.tagName= Span

.outerHTML= New permission

.outerText= .innerHTML= .innertext= New permission

.isContentEditable= False

.tostring= [ HTMLSpanElement]

.ID= ""

, . PM .., .

+4
1

getElementsByTagName('input'), Checked = True

Dim element as Object
element = getElementsByTagName('input')
element.Checked = True

, . ,

+3

All Articles