How to load specific range of html into Excel?

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

For excel 2003, does anyone have any suggestions on how to load specific
range of html into Excel? For example, I would like to load following link
for HKB into sheet(HKB), because the page is so long, and I cannot import the
whole page into excel with limited rows.
http://www.hkex.com.hk/eng/stat/dmstat/dayrpt/dqe100302.htm#HKB

I would like to load starting from
"CLASS HKB - HSBC HOLDINGS PLC"
.... [all texts are included]
until the following text is found, then stop loading, and the following text
is not included.
"CLASS HKG - HONG KONG & CHINA GAS"

Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric
 
For excel 2003, does anyone have any suggestions on how to load specific
range of html into Excel? For example, I would like to load following link
for HKB into sheet(HKB), because the page is so long, and I cannot importthe
whole page into excel with limited rows.http://www.hkex.com.hk/eng/stat/dmstat/dayrpt/dqe100302.htm#HKB

I would like to load starting from
"CLASS HKB - HSBC HOLDINGS PLC"
... [all texts are included]
until the following text is found, then stop loading, and the following text
is not included.
"CLASS HKG - HONG KONG & CHINA GAS"

Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric

Eric...Try the following. Note that the Microsoft Forms 2.0 Object
Library must be referenced...Ron

Dim mystring As New DataObject

Sub test()
' Open IE to desired website
Set ie = CreateObject("InternetExplorer.Application")

With ie
.Visible = True
.Navigate "http://www.hkex.com.hk/eng/stat/dmstat/dayrpt/
dqe100302.htm#HKB "
.Top = 50
.Left = 530
.Height = 400
.Width = 400

Do Until Not ie.Busy And ie.ReadyState = 4
DoEvents
Loop

' Get innertext for desired item and assign to clipboard
' NOTE: Tools-References: Microsoft Forms 2.0 Object Library must be
referenced

my_var = ie.document.all.Item("HKB").innertext
mystring.SetText my_var
mystring.PutInClipboard
ActiveSheet.PasteSpecial Format:="Text"
End With

ie.Quit
Range("A1").Select
End Sub
 
Back
Top