Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

programmatically retrieve links from web page

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Loane Sharp - 25 Jan 2006 23:11 GMT
Hi there

I am using the Microsoft XML v6.0 library to retrieve a web page from the
Internet, as follows:

 Dim oHttp As Object
 Set oHttp = CreateObject("MSXML2.XMLHTTP")
 oHttp.Open "GET", "http://www.microsoft.com/default.aspx", False
 oHttp.Send
 content = oHttp.responseText

Once downloaded, I want to search through the page for all URLs that link
through to other web pages (ie. contained within <a> </a> tags). The problem
is that, given the huge diversity of formats for links (relative and
absolute references, url-encoding, etc.), I'm struggling to write out all
the possibilities in code.

Is there an easier way to retrieve the contents of a specific element in a
web page, or even better, to scroll through collections of elements? I've
tried XML proper (MSXML2.DOMDocument40) but this doesn't seem to work with
HTML pages' loose structure.

Best regards
Loane
Nate Oliver - 25 Jan 2006 23:26 GMT
Hi Loane,

Different approach, but see the following:

http://www.dicks-blog.com/archives/2004/09/22/automating-internet-explorer/

Regards,
Nate Oliver

> Once downloaded, I want to search through the page for all URLs that link
> through to other web pages (ie. contained within <a> </a> tags). The problem
> is that, given the huge diversity of formats for links (relative and
> absolute references, url-encoding, etc.), I'm struggling to write out all
> the possibilities in code.
Loane Sharp - 26 Jan 2006 15:15 GMT
Hi Nate
What a simple, elegant solution. Thanks a stack
Best regards
Loane
> Hi Loane,
>
[quoted text clipped - 11 lines]
>> absolute references, url-encoding, etc.), I'm struggling to write out all
>> the possibilities in code.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.