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

[µo°Ý] ¥Ñºô­¶¨ú±oªº¸ê®Æ¡A¤£ª¾¹D­n¦p¦ó¦P¨B½s½X¦¨¥¿½T¤§¤¤¤å½X¦^¶Ç

¦^´_ 5# c_c_lai

¿à¤j¸Õ¸Õ¡A§Ú¥u·|®³¥H«eªº¨Ó§ï

  1. Sub ÃÒ¥æ©Ò()
  2.    
  3.   Dim strText As String
  4.   Dim i As Integer
  5.   Dim j As Integer
  6.   Dim nRow As Integer
  7.   Dim xRow As Integer
  8.   Dim nCol As Byte
  9.   Dim TR As Object
  10.   Dim TD As Object
  11.   Dim Arr()
  12.   Cells.Clear
  13.   
  14.   With CreateObject("winhttp.winhttprequest.5.1")
  15.     .Open "POST", "http://www.twse.com.tw/ch/trading/exchange/TWTB4U/TWTB4U.php", False
  16.     .setrequestheader "Referer", "http://www.twse.com.tw/ch/trading/exchange/TWTB4U/TWTB4U.php"
  17.     .setrequestheader "Content-Type", "application/x-www-form-urlencoded"
  18.     .Send "input_date=105%2F06%2F15&select2=21&login_btn=+%ACd%B8%DF+"
  19.     strText = BinToStr(.ResponseBody, "BIG5") '­nª`·Nºô­¶½s½X
  20.   End With
  21.   
  22.   With CreateObject("htmlfile")
  23.     .Write strText
  24.             Set hTable = .all.tags("table")(8)
  25.             tt = hTable.Rows.Length
  26.                 With ActiveSheet
  27.                     For i = 0 To hTable.Rows.Length - 1
  28.                         For j = 0 To hTable.Rows(i).Cells.Length - 1
  29.                                 .Cells(i + 1, j + 1) = hTable.Rows(i).Cells(j).innertext
  30.                         Next
  31.                     Next
  32.                 End With
  33.    
  34.   End With
  35. End Sub
  36. Function BinToStr(arrBin, strChrs)
  37.     With CreateObject("ADODB.Stream")
  38.         .Type = 2
  39.         .Open
  40.         .Writetext arrBin
  41.         .Position = 0
  42.         .Charset = strChrs
  43.         .Position = 2
  44.         BinToStr = .ReadText
  45.         .Close
  46.     End With
  47. End Function
½Æ»s¥N½X

TOP

¦^´_ 7# c_c_lai

¿à¤j¥H«eÀ°§U¤p§Ì«Ü¦h¡A¤p§Ì¥u§â¥H«e§ÛªºªF¦è­×§ï¤@¤UÅý¿à¤j¸Õ¸Õ

TOP

        ÀR«ä¦Û¦b : ¨Ã«D¦³¿ú¾{¬O§Ö¼Ö¡A°Ý¤ßµL·\¤ß³Ì¦w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD