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

[­ì³Ð] ¶°«O¸ê®Æ(§ïª©«á)

[­ì³Ð] ¶°«O¸ê®Æ(§ïª©«á)

³Ìªñ¶°«Oºô¯¸§ïª©¡A¦]¦¹¼g¤F¦¹µ{¦¡¡A¦ý¥u¬O²Ê²¤¦a§â¸ê®Æ§ì¤U¨Ó¡A¨S¦³¦h¥[¾ã²z

­Y¦³À°§U¨ì±z¡A§Æ±æ±z¦b¤U¤è¯d­Ó¨¥Åý§Úª¾¹D³á:loveliness:

­Ó¤H¤£¤Ó³ßÅwIEªk¡A©Ò¥H¥Îªº¬OWinHttpRequest¡A³t«×§Ö«Ü¦h
  1. Sub test()

  2. Cells.Clear

  3. Dim myXML As Object
  4. Set myXML = CreateObject("WinHttp.WinHttpRequest.5.1")

  5. Dim myHTML As Object
  6. Set myHTML = CreateObject("HTMLFile")

  7. With myXML
  8.     .Open "POST", "https://www.tdcc.com.tw/smWeb/QryStockAjax.do", False    '¥ý§ì¨ú¤é´Á
  9.     .setRequestHeader "Content-type", "application/x-www-form-urlencoded;charset=UTF-8"
  10.     .send "REQ_OPR=qrySelScaDates"
  11.    
  12.     myText = .responseText
  13.     myText1 = Split(myText, ",")
  14.     k = 1
  15.     For Each myText2 In myText1
  16.         Cells(1, k) = Replace(myText2, Chr(34), "")
  17.         Cells(1, k) = Replace(Cells(1, k), "[", "")
  18.         Cells(1, k) = Replace(Cells(1, k), "]", "")
  19.         k = k + 1
  20.     Next
  21.    
  22.     i = 6
  23.    
  24.     For Each myDate In Range("A1:BH1").Value
  25.         
  26.         .Open "POST", "https://www.tdcc.com.tw/smWeb/QryStockAjax.do", False    '¥N¤J¤é´Á¼´¸ê®Æ
  27.         .setRequestHeader "Content-type", "application/x-www-form-urlencoded"
  28.         .send "scaDates=" & myDate & "&scaDate=" & myDate & "&SqlMethod=StockNo&StockNo=2330&StockName=&REQ_OPR=SELECT&clkStockNo=2330&clkStockName="
  29.       
  30.         myHTML.body.innerHTML = .responseText
  31.    
  32.         Set myTable = myHTML.getElementsByTagName("table")(7)
  33.         
  34.         For Each myRow In myTable.Rows
  35.             j = 1
  36.             For Each myCell In myRow.Cells
  37.                 Cells(i, j) = myCell.innerText
  38.                 j = j + 1
  39.             Next
  40.             i = i + 1
  41.         Next
  42.         i = i + 5
  43.         L = L + 1
  44.         If L > 10 Then Exit For '­n§ì´Xµ§¸ê®Æ
  45.     Next
  46.    
  47. End With
  48. Set myXML = Nothing
  49. Set myHTML = Nothing

  50. End Sub
½Æ»s¥N½X
Excel VBAºô­¶¸ê®Æ¦¬¶°±Ð¾Ç:
http://forum.twbts.com/thread-20848-1-1.html

¦^´_ 1# iamaraymond

·PÁ±zªº¤À¨É¡A¦Û¤v¬P´Á¤Ñ¤]ªáÂI®É¶¡§ïµ{¦¡¡A¥ý§ä¤é´Á«á¡A¦A¨Ï¥Îquery table¤è¦¡§ì¨ú¡A±zªº¤è¦¡¤]¤£¿ù

´£¨Ñ¤@­Ó¤è¦V

https://data.gov.tw/dataset/11452

³oùØ´£¨Ñ¨C¶g©Ò¦³ªÑ²¼¤@°_¤U¸ü¡A¤£¹L­n¨C¶g§ì¨ú¡A¨S¦³¥H«eªº¸ê®Æ¡A¦pªG¤£«æªº¸Ü¡A¥Î³o­Óºô¯¸²Ö¿n¦Û¤vªº¸ê®Æ®w¤~¬O³Ì´Îªº¡A¨C¬P´Á¥u§ì¤@¦¸

TOP

¦³¬Ý¨ì¤F¡AÁÂÁÂ!!

¦ý½Ð°Ý¤@¤U­n¦p¦ó­×§ïªÑ²¼¥N¸¹¬°ÅܼÆ??

TOP

¦^´_ 2# joey0415

·PÁ§Aªº¤À¨É¡A±z´£¨Ñªººô¯¸¯uªº«Ü´Î¡A¥u¬O¤p§Ì¯uªº«Ü¯Ê¥F¨C©P³£¥h§ì¸ê®Æªº¼Ý¤OXD
QueryTable¤]¤£¿ù¡A¦]¬°³o­Óºô¯¸¸ê®Æ¸û¤Ö¡A©Ò¥H¥i¥H°õ¦æ«Ü§Ö¡A¦ý¦pªG¸I¨ì«ÜÃe¤jªº¸ê®Æ®É¥i¯à´N·|¶]«Ü¤[¡A©Ò¥H¤£ª¾¤£Ä±´N¾i¦¨¥ÎXMLHTTP§ì¸ê®Æªº²ßºD¤F
Excel VBAºô­¶¸ê®Æ¦¬¶°±Ð¾Ç:
http://forum.twbts.com/thread-20848-1-1.html

TOP

¦^´_ 3# cji3cj6xu6


¨Ò¦p»¡¥i¥H¦bB3Àx¦s®æ¿é¤JªÑ²¼¥N¸¹¡AµM«á«ü©wµ¹ÅܼơAªø³o¼Ë
stockno=[B3]
©Î¬O¥Îinputbox
stockno=inputbox("½Ð¿é¤JªÑ²¼¥N¸¹")

±µµÛ§â­ìµ{¦¡½Xªº²Ä32¦æ§ï¦¨
.send "scaDates=" & myDate & "&scaDate=" & myDate & "&SqlMethod=StockNo&StockNo=" & stockno & "&StockName=&REQ_OPR=SELECT&clkStockNo=" & stockno & "&clkStockName="
§â­ì¥»ªº2330¥ÎÅܼƨú¥N¡A°O±o¦r¦ê¸òÅܼƭn¥Î&³s±µ
Excel VBAºô­¶¸ê®Æ¦¬¶°±Ð¾Ç:
http://forum.twbts.com/thread-20848-1-1.html

TOP

¸U¤À·PÁÂ~~

TOP

Dear iamaraymond ¤j¡A

¦³¬Ý¨ì¨â­Ó°ÝÃD¡A¤£¾å±o¨ä¥L¤H¬O§_¤]¹J¨ì:
1.  ¤é´Áªº³¡¤À§A§ì¤U¨Ó«á©ñ¦bA1, B1, C1.......¡A¨Ã¤£¬O©ñ¦b¨C¥÷¸ê®Æªº¤W¤è¡A¤£¹L·å¤£±»·ì¡A¬Ý¤@¤U´NÀ´¤F¡C
2.  ·í«ö¤U Run«á¡A·|¥X²{°õ¦æ¶¥¬q¿ù»~°T®§¨Ã«ü¦V©ó (.send "REQ_OPR=qrySelScaDates")¡A©ó¬O§Ú¦b¶}ÀYªº¦ì¸m¼g¤J¤F On Error Resume Next ¡A¤§«á´N¥¿±`¤F¡A¤£¾å±o·|¦³«á¿ò¯g¶Ü?

ÁÙ¦³­Ó¤p°ÝÃD·Q°Ý¤@¤U¡A
½Ð°Ý§Ú·Q¸õµÛ§ì¸ê®Æ¡A¨Ò¦p:¨â¬P´Á§ì¤@µ§¡A¤£¾å±o­n­×§ï­þ¸Ì?­Y¦³ªÅ¡A¦A½Ð«ü¾É¤@¤U¡CÁÂÁÂ~~

TOP

Dear iamaraymond ¤j¡A

Sorry¡A §Ú¥J²Ó¬Ý¤F¤@¤U¡A§Ú¤j·§ª¾¹D¸Ó¦p¦ó­×§ï¦¨§Ú­nªºªF¦è¤F¡C
³Â·Ð±z¤F~~

TOP

¦^´_ 5# iamaraymond
½Ð±Ðiamaraymond¤j:¦p¦ó§â§ì¤U¨Óªº¤é´Á©ñ¦b¨C¥÷¸ê®Æªº¤W¤è,¦Ó¤£¬O©ñ¦bA1, B1, C1.......,ÁÂÁÂ
¦~ÄÖ¤£¤p,¦ý§Ú«Ü·Q¾Ç

TOP

¥»©«³Ì«á¥Ñ quickfixer ©ó 2018-3-28 18:14 ½s¿è

§Ú»{¬°³oÃ䪺µ{¦¡§¹¦¨«×¸û°ª
¦Ó¥B§ó·sµ{¦¡«D±`ªº§Ö,®É¶¡¤ñ¼Ó¥DÁÙ¦­´X¤Ñ
¥i±¤¨S¤°»ò¤H¬Ý
https://www.mobile01.com/topicdetail.php?f=511&t=4737630

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤Hªº§Ö¼Ö¡D¤£¬O¦]¬°¥L¾Ö¦³±o¦h¡A¦Ó¬O¦]¬°¥L­p¸û±o¤Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD