- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2016-8-20 10:09 ½s¿è
¦^´_ 1# PKKO
¸Õ¸Õ¬Ý- Option Explicit
- Const Img = "d:\Tel.jpg"
- Sub Ex_()
- Dim i As Integer, E As Object, a, St As String, x As Integer, Sh As Worksheet
- St = "search/"
- Set Sh = ActiveSheet
- With Sh
- .Cells.Clear
- .Pictures.Delete
- .Columns("A:A").ColumnWidth = 29.25
- .Columns("B:B").ColumnWidth = 33.13
- .Columns("C:C").ColumnWidth = 28.5
- .Cells.RowHeight = 19.5
- End With
- With CreateObject("InternetExplorer.Application")
- .Visible = True
- .Navigate "https://www.iyp.com.tw/search.php?a_id=5&k=%E9%A4%90%E5%BB%B3"
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- With .Document
- For Each a In .getElementByID("search-res").all.TAGS("LI")
- If a.ID <> "" Then
- i = i + 1
- With a
- Sh.Cells(i, "a") = .all.TAGS("A")(0).INNERTEXT
- Sh.Cells(i, "d") = .all.TAGS("A")(0).href
- Set E = .all.TAGS("SPAN")(2)
- With Sh.Cells(i, "B")
- .Cells = Split(E.outerHTML, """>")(0)
- x = InStr(.Cells, St)
- .Cells = Mid(.Cells, x + Len(St))
- End With
- ¤U¸üºô¸ô¹Ï¤ù .all.TAGS("IMG")(0).href
- With Sh.Cells(i, "C")
- .Select
- Set E = Sh.Pictures.Insert(Img)
- E.Height = .Cells.Height '·Ó¤ùªº¥k¤è¦b¤u§@ªí¤Wªº¦ì¸m
- E.Width = .Cells.Width
- End With
- End With
- End If
- Next
- End With
- .Quit 'Ãö³¬ºô¶
- End With
- If Dir(Img) <> "" Then Kill Img
- End Sub
- Private Sub ¤U¸üºô¸ô¹Ï¤ù(Url As String)
- Dim xml As Object '¥Î¨Ó¨ú±oºô¶¸ê®Æ
- Dim stream 'As ADODB.stream '¥Î¨ÓÀx¦s¤G¶i¦ìÀÉ®×
- Set xml = CreateObject("Microsoft.XMLHTTP")
- Set stream = CreateObject("ADODB.stream")
- xml.Open "GET", Url, 0
- xml.send
- With stream
- .Open
- .Type = 1
- .write xml.ResponseBody
- If Dir(Img) <> "" Then Kill Img
- .SaveToFile (Img)
- .Close
- End With
- End Sub
½Æ»s¥N½X |
|