Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Import HTML code into Excel

Hello guys,

Does anybody have any idea how can I pick html code from a webpage, and
paste into excel, line by line? The link from the webpage is a
variable, so I will get the information right from the web. All I need
is that:

Excel picks up the variable "link";

Get the html code from the "link" url, and place, line by line into
Excel as TEXT.

Could anybody help me?? PLEAAASSSE :)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Import HTML code into Excel

Hi josuegm,

josuegm wrote:
Does anybody have any idea how can I pick html code from a webpage,
and paste into excel, line by line? The link from the webpage is a
variable, so I will get the information right from the web. All I need
is that:

Excel picks up the variable "link";

Get the html code from the "link" url, and place, line by line into
Excel as TEXT.


This should work:

Public Function gsGetHTML(rsURL As String) As String
Dim x As Object

Set x = CreateObject("Microsoft.XMLHTTP")

With x
.Open "GET", rsURL
.send
Do Until .ReadyState = 4
DoEvents
Loop
gsGetHTML = .ResponseText
End With

Set x = Nothing
End Function

Sub Demo()
Dim sHTML As String
Dim vHTML As Variant
Dim lRow As Long

sHTML = gsGetHTML(Range("A1").Value)
vHTML = Split(sHTML, vbCrLf)
For lRow = 2 To UBound(vHTML) + 2
Cells(lRow, 1).Value = vHTML(lRow - 2)
Next lRow
End Sub

Just put a URL in A1 and execute Demo(). There's no error handling, so you
may want to add some in (or at least check the validity of the URL).

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Import HTML code into Excel

Thanks man! Worked perfectly!!!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I import raw HTML source code into Excel? J Diorio Excel Programming 5 July 11th 08 06:37 AM
How to import html file in excel 2007 AeonBlue Excel Discussion (Misc queries) 2 June 5th 07 11:27 PM
auto import a table into excel from a html ceemo[_63_] Excel Programming 1 April 27th 06 04:47 PM
Import HTML code from a text file. [email protected] Excel Programming 2 April 1st 05 07:47 AM
HTML TAGS that format Data for import into Excel Warren LaFrance Excel Programming 1 November 5th 03 03:46 PM


All times are GMT +1. The time now is 02:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"