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

[µo°Ý] ¦p¦ó±Æ°£°ÝÃD ?

[µo°Ý] ¦p¦ó±Æ°£°ÝÃD ?

·Q­n¦¹µ{¦¡ªºµ²ªG , ©Ò¥HCopy¨Ó¹B¥Î , ¦ý°õ¦æ®É³£¥X²{¦b Dim myDOC As HTMLDocument ³o¦æ , Åã¥Ü"¨Ï¥ÎªÌ¦Û©w«¬ºA©|¥¼©w¸q"ªº°ÝÃD¦Ó¤¤Â_ ,
½Ð°Ý³o­n¦p¦ó¥h¸Ñ¨M§r ?? TKS .




Sub ¦~«×ªÑ»ù_¤WÂd(StockNo)

    theURL = "http://www.tpex.org.tw/web/stock/statistics/monthly/result_st42.php?timestamp=1405008334769"

    Dim XMLHTTP
    Set XMLHTTP = CreateObject("microsoft.xmlhttp")
    Dim result As Variant
    Dim TargetSheet As String
    Dim myDOC As HTMLDocument
   
   '¦s©ñHTMLªí®æ¸ê®Æ¤§¤u§@ªí
    TargetSheet = "YearPrice"
   
    With XMLHTTP
        .Open "POST", theURL, False
        .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
        .setRequestHeader "Content-length", 45
        .setRequestHeader "Connection", "close"
        .send "ajax=true&input_stock_code=" & StockNo
    End With
        
   '«Ø¥ß HTML Document ª«¥ó
    Set myDOC = New HTMLDocument
   
   '±NXMLHTTPªº§ì¨ì¸ê®Æ­Ë¤JmyDOCª«¥ó
    myDOC.body.innerHTML = XMLHTTP.responseText

    Set XMLHTTP = Nothing

   '¨ú±o©Ò¦³ªí®æ
    Dim HTML_ALL_TABLE As Variant
    Dim myTable As HTMLTable
    Dim myRow As HTMLTableRow
    Dim myCell As HTMLTableCell

   
   '²M°£¤W¤@ÀɪºªÑ»ù
    Sheets(TargetSheet).[A1:T200].ClearContents
   
    Set myTable = myDOC.getElementsByTagName("TABLE").Item(2)  '2014/01/03§ï

    Debug.Print myTable.innerHTML
   
   '§PÂ_¦³µLªÑ»ù¸ê®Æ¤§ª¬ªp
    If myTable Is Nothing Then Exit Sub

   '±NªÑ»ù¸ê®Æ§Û¨ìtemp¤u§@ªí
    r = 2
   
    For Each myRow In myTable.Rows
        c = 0
        For Each myCell In myRow.Cells
            c = c + 1
            If c = 6 Or c = 8 Then
                Sheets(TargetSheet).Cells(r, c) = "'" & myCell.innerText
            Else
                Sheets(TargetSheet).Cells(r, c) = myCell.innerText
            End If
            DoEvents
        Next
        r = r + 1
    Next

End Sub

ÁÂÁ¦^ÂÐ , °ÝÃD¤w¸Ñ¨M¤F...................

TOP

¦^´_ 1# oliwa
»Ý¥[¤J¡G

TOP

        ÀR«ä¦Û¦b : ¡i¬O§_µo´§¤F¨}¯à¡H¡j¤H¶¡¹Ø©R¦]¬°µu¼È¡A¤~§óÅã±o¬Ã¶Q¡CÃø±o¨Ó¤@½ë¤H¶¡¡AÀ³°Ý¬O§_¬°¤H¶¡µo´§¤F¦Û¤vªº¨}¯à¡A¦Ó¤£­n¤@¨ý¨Dªø¹Ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD