View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
Randy Harmelink Randy  Harmelink is offline
external usenet poster
 
Posts: 122
Default Importing Web Page with Hyperlinks into Excel

I've done that type of thing with an add-in I wrote. It's free and
open source and can be found at this Yahoo Group:

http://finance.groups.yahoo.com/group/smf_addin/

The primary purpose of the add-in -- to grab financial information off
the web -- would be meaningless to you. However, I often use the
RCHGetWebData() function to do "cascading finds" of data on a web
page.

For example, at its simplest, this function would return the first
32727 bytes of a web page:

=RCHGetWebData(....url...., 1)

I've use this function in a cascading function to extract all kinds of
data off of web pages, even things like my NetFlix movie queue. It's
pretty much just a matter of finding the right pattern to find each
next item you want to extract, then using MID() function to extract
the details of each pattern.

Look for this file in the "Templates and Examples" folder of the files
area:

SMF-Template-RCHGetWebData-Cascading-Extraction.xls

It is an example of using the cascading extraction technique to
interpret something as simple as a text file, but the general
technique is the same.

On Aug 4, 7:40 pm, feltra wrote:

I need to read a page from the web and import it in Excel,
programatically (ie. thru a macro). This page contains some text that
have hyperlinks... A typical example of the page is:

---------------------------------------------------------------------------
Sample Page with Links

Text line 1....
Text line 2...
.....
....
Link to Data Set 1
Link to Data Set 2
.....

----------------------------------------------------------------------------

The lines "Link to Data Set 1" and "Link to Data Set 2" are links to
another page(s). I need to get THESE LINKS into the Excel sheet, along
with the text. Is this possible at all?

I am open to experiementing with WebQuery or any other method,
including editing the .iqv file manually, if that will work.

Alternative 1:
If it is simply not possible from within Excel, the first workaround
is to try to get the source page of the web page. Is it possible to
get the Source of the web page using WebQuery or any other methods in
Excel VBA?

Alternative 2:
Any other roundabout method of using other tools such as PERL etc, and
finally getting them into Excel?

Please note:
The option of copying manually by doing a select all and pasting into
Excel or from IE 6 using Right-mouse-button option of Exporting to
Excel is not a solution in this case, because, I need to access a
whole lot of such pages (as given in the sample above) - about
thousands of them... (over a period of time). So it has to be done
programatically.

Advance thanks for any & all feedback.

Thanks & Best Regards,
-feltra

PS: I am just a beginner in Excel VBA and learn mostly by using
Recorded Macros to understand whats happening, so please bear with me
if i take time to understand... thanks.