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

[µo°Ý] ½Ð°Ý ¦p¦ó¥Î vba ÂIÀ»ºô­¶¬d¸ß

¦^´_ 1# GaryC
  1. With .Document
  2.             .all("myear").Value = Year(xDate) - 1913 '¤é´Á¥i­×§ï
  3.            MsgBox .getElementsByName("myear")(0).Value
  4.             .all("mmon").Value = Format(Month(xDate) - 1, "0#")
  5.             For Each E In .GetElementsByTagName("INPUT")
  6.                 If E.Value = "¬d¸ß" Then E.Click
  7.             Next
  8.         End With
½Æ»s¥N½X
¨C¤@­Óºô­¶(HTM )ªº«Ø¸m³£¤£¤@¼Ë.
  1. Option Explicit
  2. Sub Ex_ºô­¶¤¸¯À()
  3.     Dim i As Integer, E As Object
  4.     With CreateObject("InternetExplorer.Application")
  5.         .Visible = True
  6.         .Navigate "http://www.twse.com.tw/ch/trading/indices/MI_5MINS_HIST/MI_5MINS_HIST.php"
  7.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  8.         With .Document
  9.           '*** ³o¬qµ{¦¡½X¥i¬d¬Ý³oºô­¶ªº¤¸¯À¤º®e
  10.             On Error Resume Next
  11.             For Each E In .all
  12.                 i = i + 1
  13.                 Cells(i, "a") = E.tagname '¨Ï¥Î .GetElementsByTagName("INPUT")
  14.                 Cells(i, "b") = E.ID      '¨Ï¥Î .GetElementByID("menu")
  15.                 Cells(i, "c") = E.Name    '¨Ï¥Î .all("myear")
  16.                                           '.getElementsByName("myear")(0).Value ' = Year(xDate) - 1911
  17.                                           ' HTML ¤¤³q±`¨ã¦³¬Û¦Pªº name ÄÝ©Ê¡^¡A©Ò¦³ getElementsByName() ¤èªkªð¦^ªº¬O¤¸¯Àªº¶°¦X¡A¦Ó¤£¬O³æ¤@­Ó¤¸¯À¡C
  18.                 Cells(i, "d") = E.Value
  19.                 Cells(i, "e") = E.innertext
  20.                 Cells(i, "f") = E.Type
  21.                 Cells(i, "g") = E.href
  22.             Next
  23.         End With
  24.     '    .Quit        'Ãö³¬ºô­¶
  25.     End With
  26. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¬°¦Û¤v§äÂǤfªº¤H¥Ã»·¤£·|¶i¨B¡C
ªð¦^¦Cªí ¤W¤@¥DÃD