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

[µo°Ý] ¦p¦ó¥ÎVBA±±¨î¤WÂd­ÓªÑ¦¨¥æºô­¶option ±±¨î¶µ

[µo°Ý] ¦p¦ó¥ÎVBA±±¨î¤WÂd­ÓªÑ¦¨¥æºô­¶option ±±¨î¶µ

¦U¤j¦n¡G
·Q½Ð±Ð¤@¤U¡A¦p¦ó¨Ï¥ÎVBA¨Ó±±¨î¤WÂd­ÓªÑ¦¨¥æºô­¶(http://www.otc.org.tw/web/stock/aftertrading/otc_quotes_no1430/stk_wn1430.php?l=zh-tw)
¤¤  Åã¥Ü "¥þ³¡"µ§ªº option ±±¨î¶µ¡Aºô­¶¤¤½Ð¿ï¾ÜÃþªÑ»P¸ê®Æ¤é´Áªºoption ±±¨î¶µ¡A¤w¸g·|¨Ï¥ÎVBA¶i¦æ¾Þ±±¡A¥i¬OÅã¥Üµ§¼Æ¸ê®Æªºoption ±±¨î¶µ¦n¹³
»PTable ¦³ ¬ÛÃö³s¡A¬G¬Ý¹Lºô­¶ªº­ì©l½X¤£ª¾¦p¦ó¨Ï¥ÎVBA¶i¦æ±±¨î¡A½Ð¦U¦ì¤j¤j«ü±Ð¡AÁÂÁ¡I
  1. Sub ½L«á¸ê°T_¤WÂd¨C¤é¦¬½L¦æ±¡()
  2.     Dim A As Object, xDate As Date, EDATE As Date
  3.     EDATE = Date
  4.    
  5.     xDate = EDATE
  6.     '*************
  7.     'xDate = Date    '¥¿¦¡±`µ{¦¡½X
  8.     With CreateObject("InternetExplorer.Application")
  9.         .Visible = True
  10.         .Navigate "http://www.otc.org.tw/web/stock/aftertrading/otc_quotes_no1430/stk_wn1430.php?l=zh-tw"
  11.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  12. Ie_Refresh:
  13.         
  14.         With .Document
  15.       '¶ñ¤JÃþªÑ option "©Ò¦³ÃÒ¨é(¤£§tÅvÃÒ¡B¤ûºµÃÒ)"
  16.        .ALL("sect").Value = "EW"
  17.        .ALL("sect").onchange
  18.        Application.Wait Now + TimeValue("00:00:03")
  19.       '¶ñ¤J¸ê®Æ¤é´Á option
  20.        .ALL("input_date").Value = Format(xDate, "E/MM/DD")
  21.        .ALL("input_date").onchange
  22.         Application.Wait Now + TimeValue("00:00:03")
  23.       '?????
  24.       'Åã¥Ü "¥þ³¡"µ§¸ê®Æªº option VBA¦p¦ó¼g¡H¡H
  25.       '?????
  26.         End With
  27.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  28.         If InStr(.Document.BODY.innerText, "¬dµL¸ê®Æ") Then
  29.              .Quit
  30.             MsgBox Format(xDate, "E/MM/DD") & " ¬dµL¸ê®Æ"
  31.             Exit Sub
  32.            
  33.         End If
  34.         Set A = .Document.getElementsByTagName("table")
  35.            .Document.BODY.innerHTML = A(0).outerHTML '¨ú"table"
  36.       

  37.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  38.         .ExecWB 17, 2       '  Select All
  39.         .ExecWB 12, 2       '  Copy selection
  40.         .Quit        'Ãö³¬ºô­¶
  41.          With ActiveSheet    '¥i«ü©w¤u§@ªí
  42.             .UsedRange.Clear
  43.             .Range("A1").Select
  44.             .PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NOHTMLFormatting:=True
  45.         End With
  46.            End With
  47. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# hsu5120
  1. With .Document
  2.             '¶ñ¤JÃþªÑ option "©Ò¦³ÃÒ¨é(¤£§tÅvÃÒ¡B¤ûºµÃÒ)"
  3.             .all("sect").Value = "EW"
  4.             .all("sect").onchange
  5.             '¶ñ¤J¸ê®Æ¤é´Á option
  6.             .all("input_date").Value = Format(xDate, "E/MM/DD")
  7.             .all("input_date").onchange
  8.             Application.Wait Now + TimeValue("00:00:03")
  9.             ' Åã¥Ü "¥þ³¡"µ§¸ê®Æªº option VBA¦p¦ó¼g¡H¡H
  10.             'Åã¥Ü ?? ¸ê®Æ: stk_wn1430_result_length  option  -1 = >"¥þ³¡"
  11.             .all("stk_wn1430_result_length")(1).Value = -1
  12.             '.all("stk_wn1430_result_length")(1).Item(0).Selected = True '¿ï²Ä¤@­Ó
  13.             .all("stk_wn1430_result_length")(1).fireEvent ("onchange")
  14.             Application.Wait Now + TimeValue("00:00:03")
  15.         End With
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

ÁÂÁ¤j¤j´£¨Ñªºµ{¦¡½X¡A­è´ú¸Õ¥i¥H¥¿½T°õ¦æ¥B²Å¦X§Úªº»Ý¨D¡A
¤j¤j¯u¬O¤Ó¼F®`¡AÁÂÁ¡I
ÁÙ¦³joey0415 ¤]·PÁ´£¨ÑÃB¥~¸ê°T¨Ñ°Ñ¦Ò¡AÁÂÁ¡I
:)

TOP

joey0415¤j¤j¡G
¥i§_À°¦£´£¨Ñ¤@¤U¤W¥«ªÑ²¼ªººô§}¡AÁÂÁ¡I

TOP

¦^´_ 3# GBKEE

¤p²Ä¸Õrun¬Ý¬Ý
µo²{¥i¥H°õ¦æ¦b°õ¦æªº¹Lµ{µo²{ºô­¶¤¤ªº

Åã¥Ü´Xµ§¸ê®Æ(¥þ³¡,10,25,...)®É,µ{¦¡ÁöµM·|±Nºô­¶¿ï¶µ¿ï¬°"¥þ³¡"
¦ýºô­¶«o¨S¦³§ó·s¾É­P¥u¦³¦¬¨ì´Xµ§¸ê®Æ¡C
¦n¹³¬O³oÃ䦳¨Ç°ÝÃD
.all("stk_wn1430_result_length")(1).fireEvent ("onchange")

TOP

¦^´_ 3# GBKEE


ªº½T¦p¼Ó¤W¤j¤j©Ò¨¥¡A¥u§ïÅܤF¼Ð¥Ü¤º®e¡A
¦Ó¥¼¦A¦¸ RePlay All¡C

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2016-6-14 08:59 ½s¿è

¦^´_ 3# GBKEE
¦pªGÅã¥Ü¤º®e¦p¦³¦A¦¸ RePlay¡A
¥ç§Y§ó°Ê¡Aµe­±À³¬°¡G

¦¹ÃþÀ³¥Î¡A»P§Ú©Ò´£°Ýªº selectType ·¥¬°¹p¦P¡C
ªÑ²¼¸ê®Æ¶×¤J¡Aµ{¦¡°õ¦æ¦³°ÝÃD

TOP

        ÀR«ä¦Û¦b : ­n§åµû§O¤H®É¡A¥ý·Q·Q¦Û¤v¬O§_§¹¬üµL¯Ê¡C
ªð¦^¦Cªí ¤W¤@¥DÃD