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

[µo°Ý] ¹d¦ëºô §Þ³N«ü¼Ð VBA§ì¨ú°ÝÃD

¦^´_ 1# espionage
Application.Wait Now + #12:00:10 AM#   '¦bµ{¦¡¤¤'µ¥­Ô10¬í
µ¥­Ô10¬í ¤£¤@©wµ¥ªº¨ì
  1. Option Explicit
  2. Sub Ex()
  3.     Dim mysearchrange As Integer, mysearchdate As String, xR As Integer, xC As Integer
  4.     Dim xTable As Object, A As Object, C As Object, myopt As Object
  5.     For mysearchrange = 2 To 3  '³]©w­n´M§äªº¤é´Á
  6.         mysearchdate = Sheets("Á`ªí").Cells(mysearchrange, 5)  '¤é´Á®æ¦¡ yyyy-mm-dd
  7.         With CreateObject("InternetExplorer.Application")
  8.             .Visible = True
  9.             .Navigate "http://www.cnyes.com/twstock/a_technical2.aspx"
  10.             Do While .Busy Or .readyState <> 4: DoEvents: Loop
  11.             With .Document
  12.                 '--------------------¿é¤J­n¬d¸ßªºªÑ²¼¥«³õ
  13.                 For Each A In .getElementsByTagName("SELECT")
  14.                     If A.Name = "ctl00$ContentPlaceHolder1$D1" Then
  15.                         For Each myopt In A.Options
  16.                             If myopt.innertext = "¶°¤¤¥«³õ" Then
  17.                                 myopt.Selected = True
  18.                                 GoTo SeLe1
  19.                             End If
  20.                         Next
  21.                     End If
  22.                 Next
  23. SeLe1:         '-------------------¿é¤J­n¬d¸ßªº¤é´Á½d³ò
  24.                 For Each A In .getElementsByTagName("SELECT")
  25.                     If A.Name = "ctl00$ContentPlaceHolder1$D3" Then
  26.                         For Each myopt In A.Options
  27.                             If myopt.innertext = mysearchdate Then
  28.                                 myopt.Selected = True
  29.                                 A.fireEvent ("onchange")
  30.                                 GoTo SeLe2
  31.                             End If
  32.                         Next
  33.                     End If
  34.                 Next
  35. SeLe2:
  36.             End With
  37.             Do While .Busy Or .readyState <> 4: DoEvents: Loop
  38.             Do Until InStr(.Document.getElementByid("ctl00_ContentPlaceHolder1_UpdatePanel1").innertext, mysearchdate)
  39.                 'µ¥­Ô¤U¸ü:«ü­q¤é´Á¸ê®Æ
  40.                 DoEvents
  41.             Loop
  42.             Set xTable = .Document.getElementsByTagName("TABLE")(1)
  43.             ActiveSheet.UsedRange.Clear
  44.             For Each A In xTable.Rows   'TableªºRowsª«¥ó¶°¦X
  45.                 xR = xR + 1                 '¤U¤@¦C¸¹
  46.                 xC = 1
  47.                 For Each C In A.Cells       'TableªºRowª«¥óªºCellsª«¥ó¶°¦X
  48.                     Cells(xR, xC) = C.innertext
  49.                     xC = xC + 1
  50.                 Next
  51.             Next
  52.         End With
  53.     Next
  54. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¤Ó¶§¥ú¤j¡B¤÷¥À®¦¤j¡B§g¤l¶q¤j¡A¤p¤H®ð¤j¡C
ªð¦^¦Cªí ¤W¤@¥DÃD