Hi,
I posted an earilier post vb6 and shellexecute to accomplish my task but think this is better with the webrowser control.
I have to do a search with vb6 and somehow open up the third url on the search page.
On the form there is
textbox = search criteria
command button search
combobox = search engines listed (Google,MSN,Altavista)
webbrowser to hold the page.
I have never worked with this control and can't seem to figure out how to enter the search text, select the search engine click the show url button and have the third url on the search page to open up that web site.
CODE IS BELOW:
Private Sub Command1_Click()
If Text1.Text <> "" And Combo1.Text <> "SELECT ONE" Then
Select Case Combo1.Text
'holdstring = ShellExecute(0&, "open", "http://www.google.co.uk/search?as_q=dogs&hl=en&rlz=1T4GGLJ_en-GBGB232GB233&num=1&start=2", "", vbNullString, 1)
Case "ALTAVISTA"
URLTOSEARCH = "http://www.altavista.com/web/results?itag=ody&pg=aq&aqmode=s&aqa=" & Text1.Text & "&aqp=&aqo=&aqn=&kgs=1&kls=0&dt=tmperiod&d2=0&dfr% 5Bd%5D=1&dfr%5Bm%5D=1&dfr%5By%5D=1980&dto%5Bd%5D=1 5&dto%5Bm%5D=8&dto%5By%5D=2007&filetype=&rc=dmn&sw d=&lh=1&nbq=3"
Case "GOOGLE"
URLTOSEARCH = "http://www.google.co.uk/search?as_q= " & Text1.Text & "&hl=en&rlz=1T4GGLJ_en-GBGB232GB233&num=1&start=2&btnG=Google+Search&as_e pq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr= all&as_occt=any&as_dt=i&as_sitesearch=&as_rights=& safe=images"
Case "MSN"
URLTOSEARCH = "http://search.live.com/results.aspx?q=" & Text1.Text & "&mkt=en-us&FORM=LIVSOP&go.x=1&go.y=3"
End Select
Else
MsgBox "PLEASE SELECT YOUR SEARCH AND ENTER SEARCH CRITERIA"
End If
WebBrowser1.Navigate (URLTOSEARCH)
Dim Doc As HTMLDocument
Set Doc = WebBrowser1.Document
***** THIS IS WHERE I WENT THROUGH THE LINKS ON THE SEARCH PAGE ***********THAT WAS LOADED BY ,WebBrowser1.Navigate ******************(URLTOSEARCH)
Dim i As Integer
THETOTAL = WebBrowser1.Document.links.length
For i = 0 To THETOTAL
MsgBox WebBrowser1.Doc.links(i).href & i
Next
End Sub
I don't need the search page to be loaded, somehow the third url sites is what is to open.
If anybody has any ideas that would be greatly appreciated.
Thanks,
SB