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

ªÑ²¼¸ê®Æ¶×¤J¡Aµ{¦¡°õ¦æ¦³°ÝÃD

¦^´_ 10# c_c_lai
XP IE8 ¥Î 6#ªºµ{¦¡½X,¨S¥[¤W¨¾¿ùªºµ{¦¡½X
¨S¦³§A©Ò»¡ªº¿ù»~
  1. http://goodinfo.tw/StockInfo/StockBzPerformance.asp?STOCK_ID=1437 &YEAR_PERIOD=10&RPT_CAT=M_YEAR
  2. 24       1437
  3. http://goodinfo.tw/StockInfo/StockBzPerformance.asp?STOCK_ID=1438 &YEAR_PERIOD=10&RPT_CAT=M_YEAR
  4. 24       1438
  5. http://goodinfo.tw/StockInfo/StockBzPerformance.asp?STOCK_ID=1439 &YEAR_PERIOD=10&RPT_CAT=M_YEAR
  6. 24       1439
  7. http://goodinfo.tw/StockInfo/StockBzPerformance.asp?STOCK_ID=1440 &YEAR_PERIOD=10&RPT_CAT=M_YEAR
  8. 24       1440
  9. http://goodinfo.tw/StockInfo/StockBzPerformance.asp?STOCK_ID=1441 &YEAR_PERIOD=10&RPT_CAT=M_YEAR
  10. 24       1441
  11. http://goodinfo.tw/StockInfo/StockBzPerformance.asp?STOCK_ID=1442 &YEAR_PERIOD=10&RPT_CAT=M_YEAR
  12. 24       1442
  13. http://goodinfo.tw/StockInfo/StockBzPerformance.asp?STOCK_ID=1443 &YEAR_PERIOD=10&RPT_CAT=M_YEAR
  14. 24       1443
  15. http://goodinfo.tw/StockInfo/StockBzPerformance.asp?STOCK_ID=1444 &YEAR_PERIOD=10&RPT_CAT=M_YEAR
  16. 24       1444
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 11# GBKEE
©ú¤Ñ§Ú¦A¨Ó¥J²Ó´ú¸Õ¤@¤U¡C
¤£«H¨¸¡Aµ²ªG¨ÌµM¦³¿ù»~«H®§¡G

TOP

¦^´_ 11# GBKEE
ªþ¤WÀɮ׳ö¨Ñ´ú¸Õ¡G
¾ú¥vªÑ»ù§ó·s.rar (27.88 KB)

TOP

¦^´_ 13# c_c_lai
³oºô­¶¦³¬y¶qºÞ¨î.
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  c_c_lai
³oºô­¶¦³¬y¶qºÞ¨î.
GBKEE µoªí©ó 2016-6-11 07:05

¨S¿ù¡A¥¦ÁÙ·|¥á¥X°T®§¡G
  1. ºô¯¸°»´ú¨ì±zªºÂsÄý¶q²§±`, ¥Ø«e¼È®ÉÃö³¬ªA°È, ½Ðµy«á¦A­«·s¬d¸ß
½Æ»s¥N½X
ÁÂÁ±zÅo¡I

TOP

¦^´_ 14# GBKEE
ÃB¥~¦A½Ð±Ð±z¡A¦bªþ¤W¤§¡y¿Ä¸ê¿Ä¨é»P¤W¥«·í¨R.xls¡z
¿ï¯Ã¡y¿Ä¸ê¿Ä¨é  III¡z¹ïÀ³ªº¡uSub ¿Ä¸ê¿Ä¨é3()¡v¡A
url ¸Ì¬°¦ó§Ú¤@ª½§ì¤£¨ì¥¿½Tªº selectType ¹ïÀ³­È¡H
¦b¡uSub ¿Ä¸ê¿Ä¨é2()¡v¨Ï¥Î .QueryTables.Add() ªº¤è¦¡
§Y¥i¥¿½T¨ú±o¡H
ÁÂÁ±z¡I
¿Ä¸ê¿Ä¨é»P¤W¥«·í¨R.rar (109.56 KB)
TWSE »OÆWÃÒ¨é¥æ©ö©Ò.rar (5.29 KB)

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2016-6-12 15:02 ½s¿è

¦^´_ 16# c_c_lai


   
url ¸Ì¬°¦ó§Ú¤@ª½§ì¤£¨ì¥¿½Tªº selectType ¹ïÀ³­È¡H
  ºô­¶ªº«Ø¸m§Ú¨S¤Jªù,©Ò¥H§Ú¤]¦bºN¯Á¤¤


  .getElementsByName:      getElements ½Æ¼Æ-> ª«¥óªº¶°¦X
  .getElementsBytagName:  getElements ½Æ¼Æ-> ª«¥óªº¶°¦X
  .ALL.tags:                     tags ½Æ¼Æ-> ª«¥óªº¶°¦X
  .getElementById :          getElement  ³æ¼Æ ->³æ¤@ªºª«¥ó
  1. Set xTable = oHtmldoc.ALL.tags("TABLE")
  2. Stop
  3. '¬Ý¬Ý°Ï°ìÅܼƵøµ¡ xTable ªº¤º®e
  4.     Set xTable = oHtmldoc.ALL.tags("TABLE")(0)
  5. Stop
  6. '¦A¦¸¬Ý¬Ý°Ï°ìÅܼƵøµ¡ xTable ªº¤º®e
  7.     MsgBox xTable.INNERTEXT
½Æ»s¥N½X
ªþÀɤ¤¦³³\¦h¬Û¦Pªºµ{¦¡½X.,,,,,,,,,,,
  1.      TVal = Array("MS", "", "0049", "0099P", "019919T", "0999", "0999P", "01", "02", "03", _
  2.                 "04", "05", "06", "07", "21", "22", "08", "09", "10", _
  3.                 "11", "12", "13", "24", "25", "26", "27", "28", "29", _
  4.                 "30", "31", "14", "15", "16", "17", "18", "23", "9299", "19", "20", "CB")
  5.     '**************************
  6.    If .ComboBox1.Value = "Select Name" Then
  7.             MsgBox ("±z©|¥¼¿ï¾Ü¡u²£·~Ãþ§O¡v¡A½Ð©ó" & vbCrLf & "½T»{«á¦A¦¸ÂI¿ï¡y¶}±Òºô­¶¡z¡A" & vbCrLf & "ÁÂÁ±z¡I")
  8.             Exit Sub
  9.         End If        
  10.         For cts = 0 To UBound(lst)
  11.             If lst(cts) = .[D1] Then select2 = TVal(cts): Exit For
  12.         Next cts
½Æ»s¥N½X
¥i¥H¾ã¦X¤@¤U
  1. Option Explicit
  2. Const MyUrl = "http://www.twse.com.tw/ch/trading/exchange/MI_MARGN/MI_MARGN.php"
  3. Private Sub Workbook_Open()
  4.     Dim oHtmldoc, op, cts
  5.     Set oHtmldoc = CreateObject("htmlfile")
  6.     With CreateObject("msxml2.xmlhttp")
  7.         .Open "Get", MyUrl, False
  8.         .Send
  9.         Do While .Status <> 200 Or .readyState <> 4: DoEvents: Loop
  10.         oHtmldoc.write .responseText
  11.     End With
  12.     Set op = oHtmldoc.all.tags("select")("selectType")
  13.     With Sheets("Á`ªí").ComboBox1
  14.         .Clear
  15.         For cts = 0 To op.Length - 1
  16.                 .AddItem                                             '²M³æ¤è¶ô©Î¤U©Ô¦¡²M³æ¤è¶ô¤¤¥[¤J¤@­Ó¶µ¥Ø
  17.                 .List(.ListCount - 1, 0) = op(cts).Text   ' ²Ä1Äæ,³Ì¦h9Äæ
  18.                 .List(.ListCount - 1, 1) = op(cts).Value ' ²Ä2Äæ,³Ì¦h9Äæ
  19.         Next
  20.         .Value = "Select Name"  '.List(0)  '0: «H¥Î¥æ©ö²Î­p, 1:¥þ³¡,2: «Ê³¬¦¡°òª÷......
  21.     End With
  22. End Sub
½Æ»s¥N½X
  1. Private Function Select_Name() As Integer
  2.     With Sheets("Á`ªí").ComboBox1
  3.         If .ListIndex = -1 Then MsgBox ("±z©|¥¼¿ï¾Ü¡u²£·~Ãþ§O¡v¡A½Ð©ó" & vbCrLf & "½T»{«á¦A¦¸ÂI¿ï¡y¶}±Òºô­¶¡z¡A" & vbCrLf & "ÁÂÁ±z¡I")
  4.         Select_Name = .ListIndex
  5.     End With
  6. End Function
½Æ»s¥N½X
  1. Sub ¿Ä¸ê¿Ä¨é2()
  2.     Dim qdate As String, select2 As String
  3.     'Dim TVal(), cts As Integer
  4.     If Select_Name = -1 Then
  5.         Exit Sub
  6.      Else
  7.         With Sheets("Á`ªí")
  8.             qdate = Format(.[B1], "EE/MM/DD")
  9.             With .ComboBox1
  10.             select2 = .List(.ListIndex, 1)
  11.             End With
  12.         End With
  13.      End If   
  14.     With Sheets("¿Ä¸ê_¿Ä¨é")
  15.         .Select
  16.         .Cells.Clear
  17.     End With
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 17# GBKEE
¦n«Øij¦¬¨ì¤F¡A©â®É¶¡¦A¨Ó¸Õ¸Õ¾ã¦X«á¤§®ÄªG¡A
­ì¥»¸Ì­±ªº¥DÃD¼Ò²Õ¬O¦U¦Û¿W¥ßªºÀ³¥Î´ú¸Õ¡A
¬ðµo©_·Q¡A¦pªG¦P¤@¥DÃD§¡¤À§O¨Ï¥Î¤£¦P³B²z¤è¦¡¡A
¦p CreateObject("InternetExplorer.Application")¡B
.QueryTables.Add()¡B¥H¤Î CreateObject("msxml2.xmlhttp")
»P CreateObject("htmlfile") ·f°tÀ³¥Îµ¥¡A¨ÃÆ[¹î¥¦­Ì¦P®É¥~³¡
±a¤J°Ñ¼Æ¡B¦p url = "http://www.twse.com.tw/ch/trading/exchange/MI_MARGN/MI_MARGN.php?qdate=" & xDate & "&selectType=" & select2
©Î¤º³¡³B²z¤è¦¡¡A¦p .Document.ALL("input_date").Value = xDate
.Document.ALL("select2").SelectedIndex = i  ¥H¤Î¤º³¡Ä²µo¤§
.Document.ALL("login_btn").Click µ¥ªº¤£¦PÀ³¥Î¡A±q¨ä¦U§Oªº¨¤«×
¨Óµû¦ô°õ¦æ¦¨®Äªº¡C¨ÃÂǦ¹¥ç¥i±Òµo¤j®aªºª¾ªºÅv¯q¤Î¦h¤è¤§À³¥Î¡C
ÁÂÁ±zÅo¡I

TOP

¦^´_ 17# GBKEE
´ú¸Õ¥Î (¤w®M¥Î±z«Øij¤§¨ç¼Æ)
  1. Sub Test()
  2.     Dim xTable As Object, k As Integer, C As Integer, R As Integer        '  , sn As Integer
  3.     Dim url As String, cts As Integer, E As Variant, xDate As String      '  , rc As Integer
  4.     Dim oXmlhttp As Object, oHtmldoc As Object, select2 As String         '  , tm
  5.     Dim TVal() As Variant
  6.    
  7.     If Select_Name = -1 Then Exit Sub
  8.     TVal = Array("MS", "ALL", "0049", "0099P", "019919T", "0999", "0999P", "01", "02", "03", _
  9.                 "04", "05", "06", "07", "21", "22", "08", "09", "10", _
  10.                 "11", "12", "13", "24", "25", "26", "27", "28", "29", _
  11.                 "30", "31", "14", "15", "16", "17", "18", "23", "9299", "19", "20", "CB")
  12.    
  13.     xDate = Format(Sheets("Á`ªí").[B1], "EE/MM/DD")
  14.     url = "http://www.twse.com.tw/ch/trading/exchange/MI_MARGN/MI_MARGN.php?qdate=" & xDate & "&selectType=" & TVal(Select_Name)
  15.     'url = "http://www.twse.com.tw/ch/trading/exchange/MI_MARGN/MI_MARGN.php?qdate=" & xDate & "&selectType=" & Select_Name
  16.     'url = "http://www.twse.com.tw/ch/trading/exchange/MI_MARGN/MI_MARGN.php?qdate=" & xDate & "&selectType=¤ôªd¤u·~"
  17.     Set oXmlhttp = CreateObject("msxml2.xmlhttp")
  18.     Set oHtmldoc = CreateObject("htmlfile")
  19.     With oXmlhttp
  20.         .Open "Get", url, False
  21.         .Send
  22.         
  23.         Do While .Status <> 200 Or .readyState <> 4: DoEvents: Loop
  24.         
  25.         oHtmldoc.write .responseText
  26.         'MsgBox .responseText
  27.     End With
  28.    
  29.     Set xTable = oHtmldoc.ALL.tags("TABLE")
  30.     ' Stop
  31.     '  ¬Ý¬Ý°Ï°ìÅܼƵøµ¡ xTable ªº¤º®e
  32.     Set xTable = oHtmldoc.ALL.tags("TABLE")(0)
  33.     ' Stop
  34.     '  ¦A¦¸¬Ý¬Ý°Ï°ìÅܼƵøµ¡ xTable ªº¤º®e
  35.     MsgBox xTable.INNERTEXT
  36. End Sub

  37. Private Function Select_Name() As Integer
  38.     With Sheets("Á`ªí").ComboBox1
  39.         If .ListIndex = -1 Then MsgBox ("±z©|¥¼¿ï¾Ü¡u²£·~Ãþ§O¡v¡A½Ð©ó" & vbCrLf & "½T»{«á¦A¦¸ÂI¿ï¡y¶}±Òºô­¶¡z¡A" & vbCrLf & "ÁÂÁ±z¡I")
  40.         Select_Name = .ListIndex    '  Select_Name = -1,0,1,2,3,4,5,6,7,8,9,.....39
  41.     End With
  42. End Function
½Æ»s¥N½X

TOP

¦^´_ 17# GBKEE

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD