Solved

Reading a Hyperlink on a Web Page

Posted on 2002-06-03
5
146 Views
Last Modified: 2007-12-19
Hi Experts,

This is what i am trying.
Through a VB Program, i want to open a browser, and go to a perticular web page on the Internet. For eg i open
http://www.google.com/search?hl=en&ie=UTF8&oe=UTF8&q=Mohit

Now i want to go to the web page which is the first Hyperlink of the Search result.

Can i do this

Meaning the Link will say "Mohit Gupta's Homepage"
and the source will be say "www.mohit.com"

Can i get the source code i.e. "www.mohit.com"
through the VB Program - or can i some how go to this web page through my VB program.

I will be greatful if you can help me in achiving this.

Thanks a bunch in anticipation!!!!

Regards
Mohit
0
Comment
Question by:mbgupta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 200 total points
ID: 7051322
using webbrowser control you could do something like:

WebBrowser1.Navigate "http://www.google.com/search?hl=en&ie=UTF8&oe=UTF8&q=Mohit"

While WebBrowser1.Busy
    DoEvents
Wend

strLink = WebBrowser1.Document.Links(10) '' link 10
MsgBox strLink

then you can do:
webbrowser1.navigate strLink
0
 
LVL 1

Expert Comment

by:Toad224
ID: 7052636
You might be interested in looking at the Microsoft Internet Transfer ActiveX control.  With the control, you could easily get the contents of a webpage.  ie:

Dat = Inet1.OpenURL("http://www.google.com/search?hl=en&ie=UTF8&oe=UTF8&q=Mohit")

Dat would be the HTML information on the page.  You can then parse the Dat, and find the first search result link.

I hope this helps.  Good luck!
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7054293
I am more or less with Bobbit but for second approach, you could use HTML Object library to do it (parse stuff) and you get the advantage of Object model.
0
 

Author Comment

by:mbgupta
ID: 7056170
Thanks very much!!!
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7056606
your welcome :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question