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

[µo°Ý] ¦³¤j¤j¯à§ä¨ì¹d¦ëºôªºÁôÂúô§}¶Ü?¥H¤Îºô­¶¤¸¯À°ÝÃD

[µo°Ý] ¦³¤j¤j¯à§ä¨ì¹d¦ëºôªºÁôÂúô§}¶Ü?¥H¤Îºô­¶¤¸¯À°ÝÃD

¥»©«³Ì«á¥Ñ PKKO ©ó 2016-10-7 15:29 ½s¿è

http://www.cnyes.com/twstock/ps_historyprice/3514.htm
ºô§}¸Ì­±¦³¤@­Ó¶}©l¸òµ²§ô¤é´Á
½Ð¤j¤j­Ì±Ð¾É¦p¦ó§ä¥XÁôÂ꺺ô§}¡A¥i¥Hª½±µ±qºô§}·í¤¤±±¨î°_¨´¤é´Á
³o¼Ë´N¥i¥Hª½±µ¥Î¿ý»s¥¨¶°ªº¤è¦¡¤U¸ü(·Pı³oºØ¤è¦¡¤ñ¸ûí©w)

§Ú¥Ø«e¨Ï¥Îºô­¶¤¸¯À¥i¥H±±¨î°_¨´¤é´Á¡A¦ý¸I¨ì¤@­Ó°ÝÃD¬O
·í´£¥X¬d¸ß«ö¶sªº®É­Ô¡AµLªk±oª¾ºô­¶¦ó®É¶]§¹
¾É­Pºô­¶ÁÙ¨S¶]§¹¡Aµ{¦¡½X¤w¸gÄ~Äò©¹¤U°õ¦æ¤F
³o¼Ë·|¾É­P¸ê®Æ¬O(®×¤U¬d¸ß«ö¶s¤§«eªº¸ê®Æ)
  1. Sub testDL()   '¤U¸üªÑ²¼¸ê°T
  2. Set ie = CreateObject("InternetExplorer.Application")
  3. ie.Visible = True
  4. ie.Navigate "http://www.cnyes.com/twstock/ps_historyprice/" & "3514" & ".htm"
  5. Do While ie.readyState <> 4: DoEvents: Loop
  6. st_date = "2016/01/01"
  7. With ie.Document
  8.     '¶}©l¤é´Á
  9.     For Each E In .GetElementsByTagName("INPUT")
  10.         If E.ID = "ctl00_ContentPlaceHolder1_startText" Then
  11.             E.Value = st_date: Exit For
  12.         End If
  13.     Next
  14.     '¬d¸ß«ö¶s
  15.     Do While ie.readyState <> 4 Or ie.Busy: DoEvents: Loop
  16.     For Each E In .GetElementsByTagName("INPUT")
  17.         If E.ID = "ctl00_ContentPlaceHolder1_submitBut" Then
  18.             E.Click: Exit For
  19.         End If
  20.     Next
  21.     '=================================¤U¸ü¸ê®Æ=================================
  22.     Do While ie.readyState <> 4 Or ie.Busy: DoEvents: Loop'³o¦æµ{¦¡½XµL®Ä¡AµLªk¯uªºµ¥«Ýºô­¶°õ¦æ®É¶¡
  23.     MsgBox "ºô­¶¹ê»Ú¤WÁÙ¨S§¹¦¨!¾É­P¤U¸üªº¸ê®Æ¬Oªº"
  24. End With
  25. ie.Quit
  26. End Sub
½Æ»s¥N½X
PKKO

http://www.cnyes.com/twstock/ps_historyprice/3514.htm
ºô§}¸Ì­±¦³¤@­Ó¶}©l¸òµ²§ô¤é´Á
½Ð¤j¤j­Ì±Ð¾É¦p¦ó ...
PKKO µoªí©ó 2016-10-7 15:27


¯uªº­nªÑ»ù¸ê®Æ­n±qÃÒ¥æ©Ò»POTC¤U¸ü©ñ¶i¸ê®Æ®w¤¤¡Aª½±µ¬d§A­nªºªÑ²¼»P¤é´Á¡A§Ö¤S¤£¥Îµ¥«Ý¡A¨C¤Ñ¤U¸ü¤@¦¸¡A¦Û¤v¥»¦aºÝ¬d§Ö­n¦³®Ä²v¡A§¹¥þ¤£¥Î¦Ò¼{ºô­¶¸ê®Æªº°ÝÃD

TOP

¥»©«³Ì«á¥Ñ PKKO ©ó 2016-10-7 19:28 ½s¿è

¦^´_ 2# joey0415


¤£¾å±o¤j¤j»¡ªº¬O¥H¤U¨â­Óºô¯¸¶Ü?ÃÒ¥æ©Ò»PÂd¶R¤¤¤ß
¦]¬°§Ú»Ý­nªº¬O¤@¦¸¤U¸ün­Ó¤ëªº¸ê®Æ
§Ú¦³¼g¹L¦Û°Ê¤U¸ü¡A¦ý¤£³ô¨äÂZ...

¤@¡B¥²¶·­n°Ï¤À¤WÂd»P¤W¥«
¤G¡B¸ê®Æ³£¬O¥H¤ë¬°³æ¦ì¡A³t«×§óºC
¤T¡BµLªkª½±µ³z¹Lºô§}¨ÓºI¨ú¸ê®Æ¡A¦]¬°¦³¨Ç¯S§O¦~¤ë·|²Ä¤@¦¸µLªkŪ¨ú¡A²Ä¤G¦¸°õ¦æ¤~¥i¥HŪ¨ú
¥|¡B¬Û¦P¤]¬O¥Hºô­¶¤¸¯À¨Ó¨ú±o¸ê®Æ¡A¦ý¹CÀ¸³W«hÁÙ·|®É±`Åܧó

http://www.tpex.org.tw/web/stock/aftertrading/daily_trading_info/st43.php?l=zh-tw
http://www.twse.com.tw/ch/trading/exchange/STOCK_DAY_AVG/STOCK_DAY_AVGMAIN.php
PKKO

TOP

¦^´_ 2# joey0415


    ¥Ø«eºô¸ô¤U¸ü³Ì§Öªº¬OYAHOOªº¸ê®Æ¡A¦ýYAHOOªº¸ê®Æ¤@°ï¿ù»~ªº
¥u¦³§ä¨ì¹d¦ëºô¦ü¥G¬O¤£¿ùªº¤U¸üºô¯¸
PKKO

TOP

¦^´_ 3# PKKO

³o¨â­Óºô¯¸¨S¿ù¡A¤£¹L½Ð§A¤U¸ü¨C¤Ñªº½L«á¥æ©öÀÉ¡A¤£¬O¤ëÀÉ

¤@¦~250¤Ñ¡A¤­¦~¤~1250¦¸

¤W¥«¥[¤WÂd ¦@2500¦¸¡A§A·|ª¦¤U¨Ó¡A¤@¬í¤@¦¸¡A¤@¤p®É´N¥þ³¡§ì¤U¨Ó¤F

³o¨â­Óºô¯¸¤~¦³¥¿½Tªº¸ê®Æ¡A¨ä¥¦ºô¯¸³£·|¦³°±¾÷»P¸ê®Æ¤£¥¿½Tªº°ÝÃD

¹d¦ë§Aª¦1000¦¸¬Ý¬Ý¡A§A´Nª¾¹D¸ê®Æ¤U¸ü·|¦³°ÝÃD¡Aºô­¶ªº§ÖºC¤£¬O¾aª¦ÂδN¯à¸Ñ¨M

³o¨â­Óºô¯¸¤£·|Àɪ¦ÂÎ

TOP

¥»©«³Ì«á¥Ñ ketrddem ©ó 2016-10-8 01:57 ½s¿è

¤£­n¥Îºô­¶¤¸¯À¨Ó§ì¡Aª½±µ¥Î¶×¤J´N¦n¤F ¾ú¥vªÑ»ù.rar (47.72 KB)

¶}±Ò«á¡A§â§A·Q§ìªº¾ú¥vªÑ»ù¿é¤J¨ì¡u²M³æ¡vªº²Ä¤@Äæ
µM«á«ö¡u­««Ø¾ú¥vªÑ»ù¡v
§A­nªº´NÀ°§A§ì¦nÅo
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¦^´_ 1# PKKO

¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub testDL()   '¤U¸üªÑ²¼¸ê°T
  3.     Dim IE As Object, st_date As String, xTable As Object, R As Integer, C As Integer
  4.     st_date = "2016/02/01"
  5.     Set IE = CreateObject("InternetExplorer.Application")
  6.     IE.Visible = True
  7.     IE.Navigate "http://www.cnyes.com/twstock/ps_historyprice/" & "3514" & ".htm"
  8.     Do While IE.readyState <> 4: DoEvents: Loop
  9.     With IE.Document
  10.         R = .ALL.tags("table")(1).Rows.Length ' '**¸ê®Æ¼Æ(§tªíÀY): ºô­¶¹w³]Åã¥Ü¬°¤@­Ó¤ëªº¸ê®Æ
  11.         '¶}©l¤é´Á
  12.         ' ************* ¦³ID ¥iª½±µ¥ÎIDªº¦WºÙ********
  13.         .GetElementByid("ctl00_ContentPlaceHolder1_startText").Value = st_date
  14.         Do While IE.readyState <> 4 Or IE.Busy: DoEvents: Loop
  15.         'For Each E In .GetElementsByTagName("INPUT")
  16.         '    If E.ID = "ctl00_ContentPlaceHolder1_startText" Then
  17.         '        E.Value = st_date: Exit For
  18.         '    End If
  19.         'Next
  20.         '¬d¸ß«ö¶s
  21.         .GetElementByid("ctl00_ContentPlaceHolder1_submitBut").Click
  22.         'For Each E In .GetElementsByTagName("INPUT")
  23.         '    If E.ID = "ctl00_ContentPlaceHolder1_submitBut" Then
  24.         '        E.Click: Exit For
  25.         '    End If
  26.         'Next
  27.         '=================================¤U¸ü¸ê®Æ=================================
  28.         Do While IE.readyState <> 4 Or IE.Busy: DoEvents: Loop    '³o¦æµ{¦¡½XµL®Ä¡AµLªk¯uªºµ¥«Ýºô­¶°õ¦æ®É¶¡

  29.         Do
  30.             DoEvents
  31.             Set xTable = .ALL.tags("table")(1)
  32.             If xTable.Rows.Length <> R And xTable.Rows.Length > 1 Then Exit Do ''** µ¥­Ô¸ê®Æ¤é¼Æµ¥©ó«ü©wªº¤é¼Æ
  33.             ' µ¥«á¸ê®Æ¤U¸ü®É: xTable.Rows.Length=1
  34.         Loop
  35.         '=================================¤U¸ü¸ê®Æ=================================
  36.         With ActiveSheet
  37.             .UsedRange = ""
  38.             For R = 0 To xTable.Rows.Length - 1
  39.                 For C = 0 To xTable.Rows(R).Cells.Length - 1
  40.                     .Cells(R + 1, C + 1) = xTable.Rows(R).Cells(C).innertext
  41.                 Next
  42.             Next
  43.         End With
  44.         MsgBox "¸ê®Æ¤U¸ü§¹¦¨!"
  45.     End With
  46.     IE.Quit
  47. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ joey0415 ©ó 2016-10-8 12:04 ½s¿è

¦^´_ 6# ketrddem

¤j¤jªº¦^µª¯u´Î¡I

½Ð°Ý¤@¤U
.PostText = "ctl00$ContentPlaceHolder1$startText=" & ¬d¸ß°_©l¤é

¤¤¥[¤Jµ²§ô¤é´Áctl00$ContentPlaceHolder1$endText¡A¦n¹³¤£·|¸õ°Ê

³o­Ó¤èªk¦n¦V¤£¥Î¦A¥[¨º¤@¦êªº__EVENTVALIDATION¬O¶Ü¡H

¦bWITH¤¤³Ì«á¥[¤W.DELETE¡A´N¥i§R°£³s½u

TOP

¦^´_ 6# ketrddem
ketrddem ¤j¤j¡A±z¦n¼F®`­C¡A¥Î¤U¸üªº¤è¦¡¤S§Ö¤Sí¡A§Y«K¿ù»~¤]¤£·|¤¤Â_= =¦n¦h°ÝÃD·Q¦V¤j¤j½Ð±Ð
¤@¡B»Pjoey0415¤j¤j°ÝÃD¬Û¦P¡A¤U¦Cµ{¦¡½XµLªk¹B§@¡A·í¦h­«±ø¥óªº®É­Ô­n¦p¦ó¿é¤J?
  1. With QT
  2. .PostText = "ctl00$ContentPlaceHolder1$startText=" & "2016/01/01"
  3. .PostText = "ctl00$ContentPlaceHolder1$endText=" & "2016/05/01"
  4. .WebTables = "2"
  5. .Refresh False
  6. .Delete
  7. End With
½Æ»s¥N½X
¤G¡B¥Î¤U¸üªº¤è¦¡¸ê®Æ¤@©w­n¥ý©ñ¦bEXCEL¤W­±¶Ü?¥i§_ª½±µ¿é¥X¨ì°}¦C¤W­±?
¤T¡B±z¦p¦ó§ä¨ì¸Ó¦r¦êªº?

¬°¦ó¤£¬O¿é¤JBÄæ¦ìªºID¦r¦ê¦Ó¬O¿é¤JCÄæ¦ìªºNAME¦r¦ê?ºô­¶³£¬O¿é¤JNAME¦r¦ê¶Ü?
¥|¡B¥u­n¬O¿é¤JÅܼƳ£¬O¨Ï¥Î.PostText ³o­Ó«ü¥O¶Ü?ÁÙ¬O¦³¦óÅܤÆ
¤­¡B©Î³\¤p§Ì°ÝÃD¤Ó¦h³y¦¨±z§x¾É¡A½Ð°Ý¥i¥H¦b­þÃä§ä¨ìÃö©ó¤U¸üªº¸Ô²Ó¬ÛÃö¤èªk©O?

¥H¤W³Â·Ð¤j¤j¤F¡A¦A¦¸´£¥X¸U¤À·P¿E
PS:¤j¤j®Ú¥»¤£¬OVBA·s¤â¡A±zÀ³¸Ó­n§âñ¦WÀÉ´«±¼¤F><"
PKKO

TOP

¦^´_ 7# GBKEE
¶Wª©¤j¤j±z¦n¡A¤p§Ì§ä¤£¨ì³o¬qµ{¦¡½Xªº¸ê®Æ
  1. Set xTable = .all.tags("table")(1)
½Æ»s¥N½X
±q°Ï°ìÅÜ¼Æ·í¤¤,¤£¾å±o³o­Ó.all.tags("table")¦b­þÃä= =


¤p§Ì¤Ó¹à¤F¡AÁٽЫü±Ð¡Aºô­¶¤¸¯À¤]¬O¸ò¶Wª©¤j¤j¾Ç²ßªº
¦ý³o­Ó.all.tags("table")¥H«e§¹¥þ¨S¬Ý¹L@@
PKKO

TOP

        ÀR«ä¦Û¦b : ¦Û¤v®`¦Û¤v¡A²ö¹L©ó¶ÃµoµÊ®ð¡C
ªð¦^¦Cªí ¤W¤@¥DÃD