PDA

View Full Version : Vba To Fill Web Page Form



copyt
07-02-2012, 07:22 AM
Hello all, I am I am struggling with the code that can fill the web-form for me. Could anybody tell me what's wrong with my code?

Any help/suggestions would be appreciated. :friends:

Sub login()
With CreateObject("InternetExplorer.Application")
.Visible = True
.navigate "http://www.uniprot.org/"
Do Until .Readystate = 4
DoEvents
Loop
.document.All("query").Value = ActiveCell.Text
.document.All("Search").Click '
End With
End Sub

Kenneth Hobs
07-02-2012, 11:23 AM
Sub login()
With CreateObject("InternetExplorer.Application")
.Visible = True
.navigate "http://www.uniprot.org/"
Do Until .Readystate = 4
DoEvents
Loop
.Document.getElementsByName("query").Item(0).Value = "enzyme"
.Document.all("text-search-submit").Click
End With
End Sub

Crocus Crow
07-02-2012, 12:02 PM
Also (getElementsByName is only available in IE9):

.document.forms("search-form").elements("query").Value = ActiveCell.Text
.document.forms("search-form").submit

copyt
07-02-2012, 01:09 PM
@ Kenneth Hobs (http://www.vbaexpress.com/forum/member.php?u=3661) and Crocus Crow (http://www.vbaexpress.com/forum/member.php?u=22001)

Thank you very much for your kind helps.