?
Solved

Reading a Hyperlink on a Web Page

Posted on 2002-06-03
5
Medium Priority
?
147 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 800 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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

777 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