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

[µo°Ý] §ì¨ú¦hºô­¶¸ê®Æ

[µo°Ý] §ì¨ú¦hºô­¶¸ê®Æ

»Ý¨D¡G§Ú»Ý­n¢²­Ó¸ê®Æ¡i½æ³õ¦WºÙ¡B½æ³õ³sµ²ºô§}¡B»ù®æ¡j

¨Ï¥Î¤u¨ã¡Gie11
¨Ï¥Îºô§}¡Ghttps://www.findprice.com.tw/
¤H¤u¶×¾ãÀɮסGhttps://drive.google.com/file/d/1I1gRapjwq-y-RrBwS0kpDDDv4RNiUgkZ/view?usp=sharing

°ÝÃD¢°¡G¬O§_¦³¤°»ò¤è¦¡¥i¥H±Nºô­¶·j´Mµ²ªGªº¦h­Óºô­¶¡A¤@¦¸§ì¨ú©ÎÂà¦s¦Ü¦P¤@excelÀɤº
¨Ò¦p¡G¥H¤Wºô­¶·j´M¡ykd-55x8000g¡z¡A·|¥X²{10­¶µ²ªG¡A¥Ø«e°µªk¬°¤@­¶¤@­¶Âà¥X¦Üexcel¡A¦A¥H¤H¤uªº¤è¦¡¶×¾ã¦¨¤@­Ó¬¡­¶¡A«D±`¯Ó®É
·j´M.PNG
2020-1-10 10:36
µ²ªG.PNG
2020-1-10 10:36


¶×¥X¦Üexcel.png
2020-1-10 10:36




°ÝÃD¢±¡G¦¹¶×¥XexcelÀɤ覡µLªk¶×¥X¨C­Ó½æ³õ³sµ²ºô§}¡A¬O§_¦³¨ä¤è¦¡¤]¥i¥H§ì±o¨ì©ÎÂà¥X¨C­Ó½æ³õ³sµ²ºô§}©O¡H­«ÂI¦b©ó§Ú»Ý­n¢²­Ó¸ê®Æ¡i½æ³õ¦WºÙ¡B½æ³õ³sµ²ºô§}¡B»ù®æ¡j
½æ³õºô§}³sµ².png
2020-1-10 10:43
*¦v¤k¤@ªTµL»~*

¦^´_ 1# msmplay
µ{¦¡½X½Æ»s¦b¦P¤@¼Ò²Õ¤W
  1.     Option Explicit
  2.     Dim ¹Ï¤ù¥Ø¿ý As String, ¹Ï¤ù¼Æ As Double, ¹Ï¤ù¦WºÙ As String
  3.     Sub Ex_§ì¨ú¦hºô­¶¸ê®Æ()
  4.     Dim I As Integer, ii As Integer, e As Object
  5.     Dim Search As String, IMG As Object, Span As Object, A As Object
  6.     Search = InputBox("kd-55x8000g", "½Ð¿é¤J­n·j´Mªº¦r¦ê")
  7.     If Search = "" Then MsgBox "¨S¦³½Ð¿é¤J......": End
  8.     With CreateObject("InternetExplorer.Application")
  9.        ' .Visible = True
  10.         .Navigate "https://www.findprice.com.tw/"
  11.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  12.         .Document.GETELEMENTBYID("search").Value = Search  '**¿é¤J­n·j´Mªº¦r¦ê
  13.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  14.         .Document.GETELEMENTBYID("tsbb").Click                           '**·j´MÁä
  15.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  16.         Set A = .Document.form1.ALL.TAGS("tbody")
  17.         If InStr(A(1).INNERTEXT, Search) = 0 Then                              '**¨S¦³·j´M¨ì
  18.             MsgBox vbLf & A(1).INNERTEXT
  19.                 GoTo Xquit
  20.         Else
  21.             ¤u§@ªí¾ã²z
  22.             Cells(1) = Trim(Split(A(1).INNERTEXT, ">")(0))
  23.             Cells(1, 2) = "»ù®æ"
  24.             Cells(1, 3) = "»¡©ú"
  25.         End If
  26.         I = 1
  27. NE:
  28.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  29.         Set e = .Document.GETELEMENTBYID("tbContent").ALL.TAGS("TR")
  30.         For ii = 1 To e.Length - 1
  31.             With e(ii).ALL
  32.                 Set A = .TAGS("A")(0)
  33.                 If Not A Is Nothing Then
  34.                     Set IMG = A.ALL.TAGS("IMG")(0)
  35.                     Set Span = .TAGS("SPAN")
  36.                     If Not IMG Is Nothing And Span.Length > 0 Then
  37.                         If Span(0).CLASSNAME = "rec-price-20" Then
  38.                             I = I + 1
  39.                             Cells(I, "b") = Trim(Span(0).INNERTEXT)
  40.                             Cells(I, "C") = Trim(IMG.Title)
  41.                             ºô¸ô¹Ï¤ù IMG.Href
  42.                             Ex_ºô­¶¸ê®Æ Cells(I, "a"), A.Href
  43.                         End If
  44.                     End If
  45.                 End If
  46.             End With
  47.         Next
  48.         '**¤U¤@­¶   '<a id="pg-next" href="/g/kd-55x8000g/?i=3">¤U¤@­¶ &gt;</a>
  49.         For Each e In .Document.ALL.TAGS("A")
  50.             If e.ID = "pg-next" Then
  51.                 e.Click              '¤U¤@­¶ («öÁä)
  52.                 GoTo NE         '´`Àô¨ì¤U¤@­¶
  53.             End If
  54.         Next
  55. Xquit:
  56.         .Quit        'Ãö³¬ºô­¶
  57.     End With
  58.     Range("b:b").Columns.AutoFit
  59. End Sub
  60. Private Sub ¤u§@ªí¾ã²z()
  61.         ¹Ï¤ù¥Ø¿ý = ThisWorkbook.Path & "\°Ó«~¹Ï¤ù\"
  62.         If Dir(¹Ï¤ù¥Ø¿ý, vbDirectory) = "" Then MkDir ¹Ï¤ù¥Ø¿ý   '**¨S¦³¹Ï¤ù¥Ø¿ý«h«Ø¥ß¤§
  63.         If Dir(¹Ï¤ù¥Ø¿ý & "*.*") <> "" Then Kill ¹Ï¤ù¥Ø¿ý & "\*.*"  '**¹Ï¤ù¥Ø¿ý¤U¦³Àɮ׫h§R°£¤§
  64.         ¹Ï¤ù¼Æ = 0
  65.        Pictures.Delete                                                                              '**§R°£¤u§@ªí¤Wªº¹Ï¤ù
  66.         With Cells
  67.             .Clear
  68.             .Columns.AutoFit
  69.             .Rows.AutoFit
  70.              .WrapText = False
  71.             .HorizontalAlignment = xlCenter
  72.             .VerticalAlignment = xlCenter
  73.         End With
  74.         With Range("c:c")
  75.             .ColumnWidth = 40
  76.             .WrapText = True
  77.         End With
  78. End Sub
  79. Private Sub Ex_ºô­¶¸ê®Æ(Rng As Range, Href As String)
  80.         With Rng
  81.             .ColumnWidth = 15
  82.             .RowHeight = 90
  83.         End With
  84.         With Pictures.Insert(¹Ï¤ù¦WºÙ)                               '**´¡¤J¹Ï¤ù
  85.             .ShapeRange.LockAspectRatio = msoFalse   '**¤£Âê©w¹Ï¤ùªºªø¼e¤ñ¨Ò
  86.             .top = Rng.top
  87.             .left = Rng.left
  88.             .Height = Rng.Height
  89.             .width = Rng.width
  90.             ActiveSheet.Hyperlinks.Add Anchor:=.ShapeRange.Item(1), Address:=Href            '***¶W³sµ²
  91.     End With
  92. End Sub
  93. Private Sub ºô¸ô¹Ï¤ù(URL As String)
  94.     Dim Xml As Object               '¥Î¨Ó¨ú±oºô­¶¸ê®Æ
  95.     Dim Stream  As Object        'As ADODB.stream   '¥Î¨ÓÀx¦s¤G¶i¦ìÀÉ®×
  96.     On Error GoTo Url_err         '³B²z¹Ï¤ùºô­¶ªº¿ù»~
  97. Again:
  98.     Set Xml = CreateObject("Microsoft.XMLHTTP")
  99.     Set Stream = CreateObject("ADODB.stream")
  100.     Xml.Open "GET", URL, 0
  101.     Xml.send
  102.     With Stream
  103.         .Open
  104.         .Type = 1
  105.         .write Xml.ResponseBody
  106.        ' If Dir(°Ó«~¹Ï¤ù) <> "" Then Kill °Ó«~¹Ï¤ù
  107.        ¹Ï¤ù¦WºÙ = ¹Ï¤ù¥Ø¿ý & ¹Ï¤ù¼Æ & ".jpg"
  108.        ¹Ï¤ù¼Æ = ¹Ï¤ù¼Æ + 1
  109.         .SaveToFile (¹Ï¤ù¦WºÙ)
  110.         .Close
  111.     End With
  112.     Set Xml = Nothing
  113.     Set Stream = Nothing
  114.     Exit Sub
  115. Url_err:
  116.     URL = "https://th.bing.com/th/id/OIP.lmGYd5XOfu-zuoG1GZW-HAHaE8?w=256&h=171&c=7&o=5&dpr=1.2&pid=1.7"
  117.     GoTo Again
  118. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¦h°µ¦h±o¡C¤Ö°µ¦h¥¢¡C
ªð¦^¦Cªí ¤W¤@¥DÃD