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

[µo°Ý] VBA ª¦ÂÎ ²^Ä_¸ê®Æ

[µo°Ý] VBA ª¦ÂÎ ²^Ä_¸ê®Æ

Dear ¤j¤j:

    ·Q¥ÎVBA ª¦ÂÎ¥\¯à°µ¤@­Ó§Q¥Î"ÃöÁä¦r" ¥i¥H¦b²^Ä_¤W·j´M½æ®aªº¸ê®Æ¡A
    ¥Ø«e¥u¯à°µ¨ì ¦bºô­¶¤W¥ý·j´M¦n¡A¦A±Nºô§}¶K¨ì¥¨¶°¤¤¡Aª¦¨ú·í¤U­¶­±ªº¸ê®Æ¡A
     
    ½Ð°Ý¤j¤j¡Aµ{¦¡­n¦p¦óÅܤƥH¤U¥\¯à
    1.±N1-100­¶ªº¸ê®Æ¡A¥Îxlmhttp ¤@¦¸§ì¤U¨Ó¡A¦Ó¥B¸ê®Æ³£¬O·í¤U³Ì·sªº
    2. ¦bEXCEL ¤¤¿é¤J"ÃöÁä¦r"¡Aª½±µ®M¨ì²^Ä_ªº·j´MÄæ¦ì¡C




20180915_²^Ä_ª¦ÂÎ-¥¼§¹¦¨.rar (33.03 KB)
Sub ²^Ä_ÃöÁä¦r·j´M_V1_20180915_2()

    Dim objhttp As Object

    Set objhttp = CreateObject("MSXML2.xmlhttp.3.0")
   
    Sheets("²^Ä_").Select
   
    myjobtype = Cells(3, "B").Value
    Tdate = Format(VBA.Date, "yyyymmdd")
    If myjobtype = "" Then
        MsgBox "½Ð¿é¤J·j´MÃöÁä¦r!!!!¤£¥iªÅ¥Õ..................kim´£¿ô¡C"
        Exit Sub
    End If
   
    Application.ScreenUpdating = False      'µe­±§ó·sÃö³¬
    URL = "https://s.taobao.com/search?q=%E5%AF%B5%E7%89%A9&type=p&tmhkh5=&spm=a21wu.241046-tw.a2227oh.d100&from=sea_1_searchbutton&catId=100"
   
    objhttp.Open "GET", URL, 1
    objhttp.send

    While objhttp.readyState <> 4: DoEvents: Wend

    Sheets("¤U¸ü").Select
   
    ROW3 = Cells(Rows.Count, 1).End(3).Row
    Range(Cells(1, 1), Cells(ROW3, 3)).Clear
   
    Cells(1, 1) = objhttp.responseText
    S = objhttp.responseText

    iStart = 1
    i = 2
   
    Do While VBA.InStr(iStart, S, "item_loc") <> 0
        
        iStart = VBA.InStr(iStart, S, "raw_title")
        iEnd = VBA.InStr(iStart, S, ",")
        Cells(i, "A") = Mid(S, iStart + 12, iEnd - iStart - 13)
        iStart = iEnd + 12
   
   
        iStart = VBA.InStr(iStart, S, "item_loc")
        iEnd = VBA.InStr(iStart, S, ",")
        Cells(i, "B") = Mid(S, iStart + 11, iEnd - iStart - 12)
        iStart = iEnd + 11
        
        iStart = VBA.InStr(iStart, S, "nick")
        iEnd = VBA.InStr(iStart, S, ",")
        Cells(i, "C") = Mid(S, iStart + 7, iEnd - iStart - 8)
        iStart = iEnd + 7
        
        i = i + 1
   
    Loop

      

End Sub

        ÀR«ä¦Û¦b : ª¾ÃÑ­n¥Î¤ßÅé·|¡A¤~¯àÅܦ¨¦Û¤vªº´¼¼z¡C
ªð¦^¦Cªí ¤W¤@¥DÃD