Auto Fill Web Control Form
Hi,
As part of my work i have to check a number of diffrent email accounts each day. I have set up a simple form using VB6 with a webbrowser control navigating to the website. I would like to not have to type in my username and password everyday. Is there anyway of auto filling these fields? The fields on the webpage are called 'user' and 'pass'. I am new to VB programming so something easy would be nice.
Many thanks for your help,
Re: Auto Fill Web Control Form
Have a look at http://home.rochester.rr.com/lgsstatic/vb.html written by Static...it might be of use
Re: Auto Fill Web Control Form
You could use this:
VB Code:
Web.Document.All("user").value = "username"
Web.Document.All("pass").value = "password"
Re: Auto Fill Web Control Form
Wow, thanks for the mention smUX :) first time ive seen someone link my site.. kinda cool :)
atmosphere.. its really fairly easy to do.. read the tutorial, it should help get u rolling. if u get stuck, just post what u are stuck on and we will help :)
and.. WELCOME! http://www.vbforums.com/
Re: Auto Fill Web Control Form
Hi, Thank you for your help. I had a look at the website. I am going though the google tutorial and trying to add 'Static' to the search box. but i get a message saying "user definded type not defined" and vb points to
Dim HTML As HTMLDocument.
Can you help me please?
Re: Auto Fill Web Control Form
And I quote from a part of the site:
"Lets introduce the HTML Object library. Go to the Project menu and select References. Then pick, Microsoft HTML Object Library."
That'll fix it :-)
Quote:
Originally Posted by Static
Wow, thanks for the mention smUX :) first time ive seen someone link my site.. kinda cool :)
I've mentioned your site about 5 or 6 times now :-P
Re: Auto Fill Web Control Form
I have added the Microsoft HTML Object Library. And useing the HTML.All.Item("q").Value = "Static"
Google now loads without any errors but the search bos does not display 'Static'.
Any ideas as to why?
Re: Auto Fill Web Control Form
post the code. where are u calling the code to set it to Static?
Re: Auto Fill Web Control Form
Here is the code. Many thanks for all of your help.
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.google.com/"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WebBrowser1.Application) Then
If URL = "http://www.google.com/" Then
Dim HTML As HTMLDocument
Set HTML = WebBrowser1.Document
'HTML.All.q.Value = "Static"
HTML.All.Item("q").Value = "Static"
End If
End If
End Sub
Re: Auto Fill Web Control Form
?? it doesnt? i pasted that code in and it works fine...
are u sure u are waiting till the page loads?
change it to this so u know if its running all of that:
VB Code:
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.google.com/"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WebBrowser1.Application) Then
If URL = "http://www.google.com/" Then
Dim HTML As HTMLDocument
Set HTML = WebBrowser1.Document
MsgBox "ABout to put STATIC in..."
HTML.All.Item("q").Value = "Static"
MsgBox "Static Should be there now"
End If
End If
End Sub
Re: Auto Fill Web Control Form
It works, I found that google was redirecting to co.uk once loaded so the ' If URL = "http://www.google.com/" Then' code did not run. But i have chnaged to .co.uk and it works fine now.
Thank you ever so much, I really did'nt ecpect so much help so quick. Its nice to know there are people willing to help each other.
Once again,
Many Thanks
Re: Auto Fill Web Control Form
:) .... u have found the best place on the web for VB help.