Skip to content Skip to sidebar Skip to footer

Vba To Complete A Internet Form

I'm looking for a code to put values from an Excel to a Webpage. Sub FillInternetForm() Dim IE As Object Set IE = CreateObject('InternetExplorer.Application') IE.navigate 'h

Solution 1:

Ana, Here is a working example. You can easily customized this little bit of code to work for you. One time you must be aware of is that I added a reference to my project under TOOLS -> Preferences -> Microsoft Internet Controls. Also another word of caution is on this line Set Elements on this line, if you are looking for something that does not exists you will end up with an error. This working example I put together goes to stack overflow and finds the elements below footer-menu. Let me know if something does not make sense.

Sub TryInternetExplorer()
 'Reference to system32\shdocvw.dll  'Microsoft Internet Controls
Dim IEApp As InternetExplorer
Set IEApp = New InternetExplorer
IEApp.Visible = True
IEApp.Navigate "https://iam.pearson.com/auth/XUI/#login/"
While IEApp.ReadyState <> READYSTATE_COMPLETE And IEApp.ReadyState <> READYSTATE_LOADED
    DoEvents
Wend

'wait for the form to load
Do
Set form = IEApp.Document.getElementsByTagName("FORM")(0) '1st table
DoEvents
Loop While form Is Nothing

 IEApp.Document.getElementsByName("callback_0")(0).Value = "Miguel"
 IEApp.Document.getElementsByName("callback_1")(0).Value = "pass"
 IEApp.Document.getElementsByName("callback_2")(0).Click


Set Document = Nothing
Set IEApp = Nothing


 End Sub

Post a Comment for "Vba To Complete A Internet Form"