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

[µo°Ý] ­n¦p¦ó¤U¸üºô­¶¤¤ªºªí®æ¸ê®Æ

¦^´_ 1# jasonwu0114
  1. Sub ºô»È()
  2.     Dim URL As String, shts As Worksheet
  3.     Dim x As Variant, xi As Integer, A As Object, xlHtm
  4.     Set shts = ActiveSheet '  '("¤u§@ªí2")
  5.     shts.Cells.Clear
  6.     URL = "https://wwwfile.megabank.com.tw/rates/M001/viewF.asp"
  7.     With CreateObject("InternetExplorer.Application")
  8.         .Visible = True     '  ¬O§_Åã¥Ü IE
  9.         .Navigate URL
  10.          Do While .ReadyState <> 4 Or .Busy
  11.                 DoEvents
  12.             Loop
  13.         Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
  14.         xlHtm = .Document.body.innerHTML                'Àx¦s
  15.         Set A = .Document.getElementsBytagname("table")
  16.         For xi = 0 To 2
  17.             .Document.body.innerHTML = A(xi).outerHTML
  18.             .ExecWB 17, 2       '  Select All
  19.             .ExecWB 12, 2       '  Copy selection
  20.             With shts
  21.                 .Range("A" & .[A65535].End(xlUp).Row + 1).Select
  22.                 .PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
  23.             End With
  24.             .Document.body.innerHTML = xlHtm                  'ÁÙ­ì
  25.         Next xi
  26.         shts.Cells.EntireColumn.AutoFit     '  ¦Û°Ê½Õ¾ãÄæ¼e
  27.         .Quit
  28.     End With
  29. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¯¸¦b¥b¸ô¡A¤ñ¨«¨ì¥Ø¼Ð§ó¨¯­W¡C
ªð¦^¦Cªí ¤W¤@¥DÃD