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

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

¦^´_ 20# c_c_lai
¬Ý¤W¹Ï106¦æ form method="post"
»¡©ú·í§AÂI¬d¸ß®É¬O¥Hpost¶Ç°e½Ð¨D¡A©Ò¥H§A¤£¯à¥u¥Îget¦bºô§}¥[°Ñ¼Æ¡C
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 21# stillfish00
½Ð±ÐÀ³¦p¦ó¸Ñ¨M©O¡H
§x³n§Ú¦h¤é¤F¡C
ÁÂÁ©p¡I

TOP

¦^´_ 20# c_c_lai
¥i¥Hµy·L°Ñ¦Ò³o©« : http://forum.twbts.com/viewthread.php?tid=15544
  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.     If Select_Name = -1 Then Exit Sub
  7.     TVal = Array("MS", "ALL", "0049", "0099P", "019919T", "0999", "0999P", "01", "02", "03", _
  8.                 "04", "05", "06", "07", "21", "22", "08", "09", "10", _
  9.                 "11", "12", "13", "24", "25", "26", "27", "28", "29", _
  10.                 "30", "31", "14", "15", "16", "17", "18", "23", "9299", "19", "20", "CB")

  11.     url = "http://www.twse.com.tw/ch/trading/exchange/MI_MARGN/MI_MARGN.php"
  12.     xDate = Format(Sheets("Á`ªí").[B1], "EE/MM/DD")
  13.     sPost = "qdate=" & Replace(xDate, "/", "%2F") & "&selectType=" & TVal(Select_Name)  'urlencode
  14.     Set oXmlhttp = CreateObject("msxml2.xmlhttp")
  15.     Set oHtmldoc = CreateObject("htmlfile")
  16.     With oXmlhttp
  17.         .Open "Post", url, False
  18.         '.setRequestHeader "Connection", "Keep-Alive"   'µu®É¶¡¤º¦h¦¸¬d¸ß«Øij¥i¥[³o¦æ
  19.         .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  20.         .setRequestHeader "Content-Length", Len(sPost)
  21.         .Send sPost
  22.         '¤W­± Open °Ñ¼Æ¥ÎFalse(=¦P¨B)¡A¥i¥H¤£¥Î¦A§PÂ_status
  23.         'Do While .Status <> 200 Or .readyState <> 4: DoEvents: Loop
  24.         oHtmldoc.write .responseText
  25.         'MsgBox .responseText
  26.     End With

  27.     Set xTable = oHtmldoc.ALL.tags("TABLE")
  28.     ' Stop
  29.     '  ¬Ý¬Ý°Ï°ìÅܼƵøµ¡ xTable ªº¤º®e
  30.     Set xTable = oHtmldoc.ALL.tags("TABLE")(0)
  31.     ' Stop
  32.     '  ¦A¦¸¬Ý¬Ý°Ï°ìÅܼƵøµ¡ xTable ªº¤º®e
  33.     MsgBox xTable.INNERTEXT
  34. End Sub
½Æ»s¥N½X
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 23# stillfish00
«D±`ÁÂÁ§A¡I
¤§«e¸I¨ìªº½m²ß³£¬O±µÄ²¨ì Get¡A
©Ò¥H¤]¨S¯d·N¦p¦ó¥hÀ³¥Î Post ªº³B­ù¡A
·PÁ§Aªº«ü¾É¡C   ¥Ø«e
TVal = Array("MS", "ALL", "0049", "0099P", "019919T", "0999", "0999P", "01", "02", "03", _
                "04", "05", "06", "07", "21", "22", "08", "09", "10", _
                "11", "12", "13", "24", "25", "26", "27", "28", "29", _
                "30", "31", "14", "15", "16", "17", "18", "23", "9299", "19", "20", "CB")
¥Ø«e´N¥u³Ñ¤U "ALL" (¥þ³¡) ªº°ÝÃD¤´§ì¤£¨ì¡A¨ä¾l³£ OK¡A©Î³\¥N½X¤£¹ï§í©Î¬O . . . . .

§Ú¦AÄ~Äò¥[ªo§a¡C
¦A¦¸ÁÂÁ§AÅo¡I

TOP

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

¦^´_ 15# c_c_lai
À³¹B  ºô­¶¦³¬y¶qºÞ¨î.
1 ÀÉ®×Ãö³¬
2­«¶}ÀÉ®×,   ­«±Òadslªº³s½u,°õ¦æµ{¦¡

¥t³]¤@­Ó­n¶}¶}ÃöÃö goodinfo_¦X¨Ö°]³øÀÉ®× ªºÀÉ®×
ThisWorkbook ¼Ò²Õªºµ{¦¡½X
  1. Option Explicit
  2. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  3.     Application.Quit
  4. End Sub
  5. Private Sub Workbook_Open()
  6.     Dim App As New Application, xFile As String
  7.     xFile = "D:\goodinfo_¦X¨Ö°]³ø.xls"  ' goodinfo_¦X¨Ö°]³øµ{¦¡ªºÀÉ®×
  8.     Application.Visible = False
  9. Re_App:
  10.     With App
  11.         .Visible = True
  12.         .Workbooks.Open (xFile)
  13.     End With
  14.     If App.Visible = False Then
  15.     Set App = Nothing
  16.     GoTo Re_App   
  17.     End If
  18.     ThisWorkbook.Close
  19. End Sub
½Æ»s¥N½X
goodinfo_¦X¨Ö°]³øÀÉ®× ThisWorkbook ¼Ò²Õªºµ{¦¡½X
  1. Option Explicit
  2. Private Sub Workbook_Open()
  3.     adsl³s½u   '°Ñ¦Ò   http://forum.twbts.com/thread-17716-1-1.html ªº adsl³s½uµ{¦¡½X
  4.     goodinfo_¦X¨Ö°]³ø
  5. End Sub
  6. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  7.     Application.Quit
  8. End Sub
  9. Sub goodinfo_¦X¨Ö°]³ø()   
  10.     Dim xTable As Object, k As Integer, C As Integer, sn As Double, r As Integer
  11.     Dim url As String, i As Double, E As Variant
  12.     Dim oXmlhttp As Object, oHtmldoc As Object, surl, op, tm
  13.    For Each E In ThisWorkbook.Names
  14.         If E.Name = "³øªí¶}©l¦C" Then GoTo xStart
  15.    Next
  16.     ThisWorkbook.Names.Add "³øªí¶}©l¦C", 1
  17.     ThisWorkbook.Names.Add "³øªí¶}®É¶¡", Time
  18.     ThisWorkbook.Activate
  19. xStart:
  20.     Sheets("Àç¹BÁZ®Ä").Activate
  21.         With Sheets("Àç¹BÁZ®Ä2")
  22.             .UsedRange.Clear
  23.         End With
  24.     For i = [³øªí¶}©l¦C] To Sheets("Á`ªí").Cells(Rows.Count, 2).End(xlUp).Row '
  25. APP_EX:
  26.         sn = Sheets("Á`ªí").Cells(i, 2)
  27.         url = "http://goodinfo.tw/StockInfo/StockBzPerformance.asp?STOCK_ID=" & sn & "&YEAR_PERIOD=10&RPT_CAT=M_YEAR"
  28.         Set oXmlhttp = CreateObject("msxml2.xmlhttp")
  29.         Set oHtmldoc = CreateObject("htmlfile")
  30.         With oXmlhttp
  31.             .Open "Get", url, False
  32.             .Send
  33.             oHtmldoc.write .responseText
  34.         End With
  35.         Set xTable = oHtmldoc.all.tags("TABLE")
  36.            '*********¥iÆ[¬Ý ¬y¶q³QºÞ¨î ************************************
  37.            Sheets("Àç¹BÁZ®Ä").Cells(i, 1).Resize(, 3) = Array(xTable.Length, sn, Time)
  38.            Sheets("Àç¹BÁZ®Ä").Cells(i, 1).Select
  39.            '************************************************************
  40.               If xTable.Length = 0 Then
  41.                  ThisWorkbook.Names.Add "³øªí¶}©l¦C", i
  42.                  ThisWorkbook.Close True
  43.               End If
  44.             With Sheets("Àç¹BÁZ®Ä2")
  45.             For Each E In Array(11, 13, 19) '11,13,19  "TABLE"
  46.                 k = k + 1
  47.                 For r = 0 To xTable(E).Rows.Length - 1
  48.                 For C = 0 To xTable(E).Rows(r).Cells.Length - 1
  49.                     .Cells(k, C + 1) = xTable(E).Rows(r).Cells(C).innertext
  50.                 Next
  51.                 k = k + 1
  52.                 Next
  53.             Next
  54.         End With
  55.     Next
  56.     ThisWorkbook.Names("³øªí¶}©l¦C").Delete
  57.     MsgBox "¶O®É " & Application.Text(Time - [³øªí¶}®É¶¡], "M¤ÀS¬í") & " Finished Complete!"
  58. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 25# GBKEE
ÁÂÁ±z¡I
#15 ~ #20 ¶¡ªº´£°Ý¡A³Ì«á§Ú¬O¥H
  1. .Open "Post", url, False
½Æ»s¥N½X
¨ú¥N¤F
  1. .Open "Get", url, False
½Æ»s¥N½X
¤~±o¥H¸Ñ¨M "&select2=" & TVal(Select_Name)
ªº°Ñ¼Æ¤Þ¤J°ÝÃD¡C
¥i¬O«o¥X²{¼g¤J¤§¤å¦r³¡¤À¬O¤@°ï¶Ã½X¡A
©Ò¥H¤~·|¦A¥á¥X ¥Ñºô­¶¨ú±oªº¸ê®Æ¡A¤£ª¾¹D­n¦p¦ó¦P¨B½s½X¦¨¥¿½T¤§¤¤¤å½X¦^¶Ç
¬ÛÃöªº´£°Ý¡C¤Wºô¬d¬Ý¤F Google/¶Ã½X ªº°Q½×
¦n¦ü¤£¤Ó·f¹Ç¡AÃø¥H¸ÑÃD¡C
ÁÂÁ±z¶O¤ß¦a¦^´_¡C
¤W­z "¦p¦ó¦P¨B½s½X" §Ú¥ç¦³¥[¤J¸É¥R¡A¨Ãªþ¤WÀÉ®×
¦A¦¸ÁÂÁ±z¤F¡I³Â·Ð±z¡I

TOP

        ÀR«ä¦Û¦b : ­n¥Î¤ß¡A¤£­n¾Þ¤ß¡B·Ð¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD