Inout text in Field - Excel VBA HTML

TheEnergyMan

New Member
Joined
Mar 12, 2019
Messages
12
I cant seem to work out how to input text into the text field,

when inspecting the element in google it gives me:
<input> class="gwt-Textbox" type="text" size="35">




current code im using is:
im htmldoc As HTMLDocument
Dim IE As InternetExplorer


Dim myhtml_element As IHTMLElement
Dim myurl As String
myurl = "https://www.degreedays.net/"




Set IE = New InternetExplorer


With IE
.Silent = True
.navigate myurl
.Visible = True
End With


Do
DoEvents
Loop Until IE.readyState = 4


Set htmldoc = IE.document




'This is the area I am having issues with'''


For Each ele In IE.document.getElementsByTagName("Input")
If ele.Type = "text" Then ele.Value = "EGPF"
Next ele


'this clicks generate degree days
For Each myhtml_element In htmldoc.getElementsByClassName("submitButton")
If myhtml_element.Type = "button" Then myhtml_element.Click:
Next



Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE



End Sub
 
Last edited:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
For Each myhtml_element In htmldoc.getElementsByClassName("gwt-TextBox")
If myhtml_element.Type = "text" Then myhtml_element.Value = "EGPF"
Next

I found it just after i posted, if anyone else has this issues then here is what I did to solve it
 
Upvote 0

Forum statistics

Threads
1,214,789
Messages
6,121,605
Members
449,038
Latest member
Arbind kumar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top