WarLord
asked on
HTML
Hello,
Does anybody knows how to let A VB programm fill in text boxes that are in a web page?
so that when i let my programm open www.google.com and i have a textbox in my programm and when i fill some stuff in the textbox my programm pasts the text from the textbox in the textbox from google
Greets Erik
Does anybody knows how to let A VB programm fill in text boxes that are in a web page?
so that when i let my programm open www.google.com and i have a textbox in my programm and when i fill some stuff in the textbox my programm pasts the text from the textbox in the textbox from google
Greets Erik
ASKER
ok but what about when i don't want it to open in an external internet explorer like it happens here
Use WebBrowser control in your Form and pass the same arguments stated above into your WebBrowser control
ASKER
can anyone help me with this?
when i try this
Dim WithEvents IE As InternetExplorer
Private Sub Command1_Click()
Set IE = New InternetExplorer
With IE
.Navigate "www.google.com"
.Visible = True
End With
End Sub
Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim inp As Object
Set inp = IE.Document.All.Item("q")
inp.Value = "Test"
Set inp = IE.Document.All.Item("btng ")
inp.Click
End Sub
it does everything it should do... fill in test at the textbox in the google form press the submit button etc
but when it's loaded it gives an error 438 object doesn't support this property... i think because the program reloads the page every time ( why? ) and in the second form of google the search field isn't called Q
when i try this
Dim WithEvents IE As InternetExplorer
Private Sub Command1_Click()
Set IE = New InternetExplorer
With IE
.Navigate "www.google.com"
.Visible = True
End With
End Sub
Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim inp As Object
Set inp = IE.Document.All.Item("q")
inp.Value = "Test"
Set inp = IE.Document.All.Item("btng
inp.Click
End Sub
it does everything it should do... fill in test at the textbox in the google form press the submit button etc
but when it's loaded it gives an error 438 object doesn't support this property... i think because the program reloads the page every time ( why? ) and in the second form of google the search field isn't called Q
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
or:
if (pdisp is IE) then
if instr(1,url,"what you need goes here", vbtextcompare) then
IE.Document.All.Item("q"). Value = "Test"
IE.Document.All.Item("btng ").Click
end if
end if
End Sub
if (pdisp is IE) then
if instr(1,url,"what you need goes here", vbtextcompare) then
IE.Document.All.Item("q").
IE.Document.All.Item("btng
end if
end if
End Sub
or (faster):
Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
if (pdisp is IE) then
if instr(1,url,"what you need goes here", vbtextcompare) then
with IE.Document.All
.Item("q").Value = "Test"
.Item("btng").Click
end with
end if
end if
End Sub
Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
if (pdisp is IE) then
if instr(1,url,"what you need goes here", vbtextcompare) then
with IE.Document.All
.Item("q").Value = "Test"
.Item("btng").Click
end with
end if
end if
End Sub
Optionally, you could use Google API stuff.
http://www.google.com/apis/
http://www.google.com/apis/
ASKER
Ok this stuff works all GREAT just what i needed, one more thing remaining... let's say i have a page my programm fills some stuff presses a button then it goes to the next page... how can i let my programm fill in stuff on the next page?
ASKER
not only this answer but the rest of your asnwers are also very helpfull
Checking the url is the basic way:
if instr(1,URL,"Partial_and_u nique_stri ng_of_targ et_url_goe s_here",vb textcompar e) then
'do something
end if
if instr(1,URL,"Partial_and_u nique_stri ng_of_next _target_ur l_goes_her e",vbtextc ompare) then
'do something more
end if
and so on...
if instr(1,URL,"Partial_and_u
'do something
end if
if instr(1,URL,"Partial_and_u
'do something more
end if
and so on...
'Make a reference to Microsoft Internet Controls
Dim WithEvents IE As InternetExplorer
Private Sub Form_Load()
Set IE = New InternetExplorer
With IE
.navigate "www.hotmail.com"
.Visible = True
End With
End Sub
Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is IE) Then
If InStr(1, URL, "passport.com/cgi-bin/logi
Dim inp As Object
Set inp = IE.document.All.Item("logi
inp.Value = "username" 'replace with your id
Set inp = IE.document.All.Item("pass
inp.Value = "password" 'replace with your password
Set inp = IE.document.All.Item("ente
inp.Click
End If
End If
End Sub