ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¶×¤Jºô­¶¸ê®Æ

  1. Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

  2. Sub HK()
  3.     Dim URL As String, shts As Worksheet
  4.     Dim x As Variant, xi As Integer, A As Object, xlHtm
  5.     Set shts = ActiveSheet '
  6.     shts.Cells.Clear
  7.     URL = "http://hk.ishares.com/product_info/fund/holdings/2823.htm?periodCd=d"
  8.     With CreateObject("InternetExplorer.Application")
  9.         .Visible = True     '  ¬O§_Åã¥Ü IE
  10.         .Navigate URL
  11.          Do While .ReadyState <> 4 Or .Busy
  12.                 DoEvents
  13.             Loop

  14.         xlHtm = .Document.body.innerHTML                'Àx¦s

  15.         Sleep 2000
  16.         Set A = .Document.getElementsBytagname("table")
  17.         For xi = 2 To 2
  18.             .Document.body.innerHTML = A(xi).outerHTML
  19.             .ExecWB 17, 2       '  Select All
  20.             .ExecWB 12, 2       '  Copy selection
  21.             With shts
  22.                 .Range("A1").Select
  23.                 .PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
  24.             End With
  25.             .Document.body.innerHTML = xlHtm                  'ÁÙ­ì
  26.         Next xi
  27.         shts.Cells.EntireColumn.AutoFit     '  ¦Û°Ê½Õ¾ãÄæ¼e
  28.         .Quit
  29.     End With
  30. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤@¥y·Å·xªº¸Ü¡A´N¹³©¹§O¤H¨­¤WÅx­»¤ô¡A¦Û¤v·|ªg¨ì¨â¤Tºw¡C
ªð¦^¦Cªí ¤W¤@¥DÃD