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

[µo°Ý] ºô­¶§ì¨ú¸ê®Æ¦p¦óÅý¤¤¤å§¹¾ãÅã¥Ü(¥ÎCreateObject¨t¦C)

¦^´_ 6# PKKO
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex_¤¤¤å¶Ã½X_GET()
  3.   Dim strText As String
  4.   Dim I As Integer, j As Integer, xTable As Object
  5.   With CreateObject("msxml2.xmlhttp")
  6.     .Open "GET", "http://mops.twse.com.tw/nas/t21/sii/t21sc03_107_4_0.html", False
  7.     .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  8.     .send
  9.     strText = BinToStr(.responseBody, "BIG5") '­nª`·Nºô­¶½s½X
  10.   End With
  11.   With CreateObject("htmlfile")
  12.         .Write strText
  13.         Set xTable = .all.tags("table")(2)
  14.         With ActiveSheet
  15.             .Cells.Clear
  16.             For I = 0 To xTable.Rows.Length - 1
  17.                 For j = 0 To xTable.Rows(I).Cells.Length - 1
  18.                     .Cells(I + 1, j + 1) = xTable.Rows(I).Cells(j).innertext
  19.                 Next
  20.             Next
  21.         End With
  22.   End With
  23. End Sub
  24. Function BinToStr(arrBin, strChrs)
  25.     With CreateObject("ADODB.Stream")
  26.         .Type = 2
  27.         .Open
  28.         .Writetext arrBin
  29.         .Position = 0
  30.         .Charset = strChrs
  31.         BinToStr = .ReadText
  32.         .Close
  33.     End With
  34. End Function
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : §g¤l¦p¤ô¡AÀH¤è´N¶ê¡AµL³B¤£¦Û¦b¡C
ªð¦^¦Cªí ¤W¤@¥DÃD