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

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

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

¨Ï¥Î¥H¤Uµ{¦¡½X·íºô­¶¦³¤¤¤åªº®É­Ô
¨Ò¦p[º¦¡B¶^]µ¥¦r¼Ë·|Åܦ¨¶Ã½X
¦p¦ó¥ÎCreateObject¨t¦Cªº¤è¦¡¨ÓÅý¤¤¤å¥¿½TÅã¥Ü©O?
¹Á¸Õ¥Î.setRequestHeader "charset", "utf-8"µ¥¤èªk¬ù²ö¤C¤KºØ³£µL®Ä
¦³¤j¤j¦³¸gÅç¶Ü?
  1. Sub TEST()
  2. Url = "http://mops.twse.com.tw/nas/t21/sii/t21sc03_107_4_0.html"
  3. Set HTML = CreateObject("Microsoft.XMLHTTP")
  4. With HTML
  5.     .Open "GET", Url, False
  6.     .setRequestHeader "pragma", "no-cache"
  7.     .setRequestHeader "cache-control", "no-store, must-revalidate, private"
  8.     .setRequestHeader "charset", "utf-8"
  9.     .send
  10. End With
  11. MsgBox HTML.responseText
  12. End Sub
½Æ»s¥N½X
PKKO

µ¹ÂI·N¨£
§Aªººô¯¸¬Obig5 ½s½X
©Ò¥H¸ÑªRªº®É­ÔÀ³¸Ó¬O­n¥Î big5¥h¸ÑªR
msgbox¬O¥Î­þºØ½s½XÅã¥Ü¥i¯à­n¬d¤@¤U
¦pªGmsgbox¤£¬Obig5½s½X ¤]·|¦³¶Ã½Xªºª¬ªp

TOP

¥»©«³Ì«á¥Ñ quickfixer ©ó 2018-11-12 21:51 ½s¿è

01¨ºÃä§Û¨Óªº¸Ñªk:lol

Sub TEST()
Url = "http://mops.twse.com.tw/nas/t21/sii/t21sc03_107_4_0.html"
Set HTML = CreateObject("Microsoft.XMLHTTP")
With HTML
    .Open "GET", Url, False
    .setRequestHeader "pragma", "no-cache"
    .setRequestHeader "cache-control", "no-store, must-revalidate, private"
    .setRequestHeader "charset", "utf-8"
    .send
End With
MsgBox convertraw(HTML.responsebody)
End Sub


Function convertraw(rawdata)

    Dim rawstr
    Set rawstr = CreateObject("adodb.stream")
    With rawstr
        .Type = 1
        .Mode = 3
        .Open
        .Write rawdata
        .Position = 0
        .Type = 2
        .Charset = "big5"
        convertraw = .ReadText
        .Close
    End With
    Set rawstr = Nothing

End Function

TOP

¦^´_ 2# ciboybj


msgbox ¥u¬O®i¥Üµ¹¤j¤j­Ì¬Ý
§Ú¹ê»Ú¬Oª½±µÅª¨ú¤º®e
¦ýŪ¨ú¤º®e¤]¬O¶Ã½X

·Q°Ý¦³¿ìªkÂର¥¿½Tªº¤¤¤å¶Ü?
PKKO

TOP

¦^´_ 3# quickfixer


    ·PÁÂ,§Ú©ú¤Ñ´ú¸Õ¤@¤U!!!
PKKO

TOP

¦^´_ 3# quickfixer


    ¦n±j¤jªº¤è¦¡ªü....§¹¥þ¥¿½T³t«×¤S§Ö
¤j¤j¦n·|·j´M
§Ú¬d°ê¥~ºô¯¸³£§ä¤£¨ì
¥u¦³¤@­Ó¤è¦¡¥i¥H¥Î,¦ý³t«×¤ÓºC
±zªº³o­Ó¤è¦¡¦n¼F®`!!!

¤j¤j»¡ªº01«üªº¬Omobile1¶Ü?
¤U¦¸§Ú¤]¥h¨ºÃä§ä§ä¬Ýµª®×
PKKO

TOP

¦^´_ 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

¦^´_ 7# GBKEE


«D±`·PÁ¶Wª©¤j¤j
­ì¥»¥H¬°¤T¼Ó¤w¸g¥i¥H¸Ñ¨M§Úªº°ÝÃD
¨S·Q¨ì·|²£¥Í¥X¨ä¥L°ÝÃD

¨Ï¥Î±zªºµ{¦¡½X«h§¹¥þ¨S¦³¨ä¥L°ÝÃD
¯u¬O¤Ó±j¤j¤F,¦A¦¸·PÁÂ!!!
PKKO

TOP

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