- ©«¤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
|
¦^´_ 1# kuhsuanchieh
¸Õ¸Õ¬Ý- Option Explicit
- '¶¼Æ
- Const ¶¼Æºô§} = "http://www.tyland.org.tw/pg.asp?theme=11&kinds=2&area=&search=o&review=&model=1&meid=&absolutepage="
- '·|¸¹ ID
- Const ID = "http://www.tyland.org.tw/view-m.asp?mno="
- Dim Sh As Worksheet, Ie As Object
- Sub Ex()
- Ex²{¦b·|û¦W¿ý
- Ex_©Ò¦³·|û¸ê®Æ
- End Sub
- Sub Ex²{¦b·|û¦W¿ý()
- Dim i As Integer, xTable As Object, r As Integer
- Set Ie = CreateObject("InternetExplorer.Application")
- Set Sh = Sheets(1)
- With Sh
- .UsedRange.Clear
- .[A1:E1] = Array("ID", "©m¦W", "¹q¸Ü", "¶Ç¯u", "¦a§}")
- '.[A1:D1] = Array( "©m¦W", "¹q¸Ü", "¶Ç¯u", "¦a§}")
- .Activate
- End With
- With CreateObject("InternetExplorer.Application")
- ' .Visible = True
- For i = 1 To Max_Page
- .Navigate ¶¼Æºô§} & i
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- Set xTable = .Document.all.tags("table")(0).Rows
- Application.StatusBar = ¶¼Æºô§} & i & " ¸ü¤J..."
- For r = 1 To xTable.Length - 1
- Ex_²{¦b·|û¸ê®Æ ID & xTable(r).Cells(1).INNERTEXT
- Next
- Next
- .Quit
- End With
- Ie.Quit
- Set Ie = Nothing
- End Sub
- Sub Ex_²{¦b·|û¸ê®Æ(URL As String)
- Dim ID As String, i As Integer, E As Variant, ii As Integer, t As Variant, AR()
- ID = "http://www.tyland.org.tw/view-m.asp?mno="
- AR = Array(0, 1, 2, 3, 6) 'AR = Array( 1, 2, 3, 6) ¤£n"ID"
- With Ie
- ' .Visible = True
- .Navigate URL
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- t = Split(.Document.BODY.INNERTEXT, vbLf) 'ºô¶ªº¤å¦r,vbLf ¤Á³Î¬°°}¦C
- With Sh.Range("A" & Rows.Count).End(xlUp).Offset(1)
- .Select '¥i¤£¥Î
- For ii = 0 To 4
- .Cells(1, ii + 1) = Split(t(AR(ii)), "¡G")(1)
- Next
- End With
-
- End With
- End Sub
- Function Max_Page() As Integer '¶Ç¦^·|û¦W¿ýªºÁ`¶¼Æ
- Dim E As Object
- With CreateObject("InternetExplorer.Application")
- ' .Visible = True
- .Navigate "http://www.tyland.org.tw/pg.asp?theme=11"
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- For Each E In .Document.all.tags("A")
- If InStr(E.INNERTEXT, "³Ì«á¤@¶") Then
- Max_Page = Replace(E.href, ¶¼Æºô§}, "") 'ºô¶¦r¦ê³Ì«áªº¼Æ¦r
- Exit For
- End If
- Next
- .Quit 'Ãö³¬ºô¶
- End With
- End Function
- '****************************************************
- Sub Ex_©Ò¦³·|û¸ê®Æ()
- Dim i As Integer, E As Variant, ii As Integer, t As Variant, AR()
- Dim Sh As Worksheet
- Set Sh = Sheets(2)
- With Sh
- .UsedRange.Clear
- .[A1:E1] = Array("ID", "©m¦W", "¹q¸Ü", "¶Ç¯u", "¦a§}")
- '.[A1:D1] = Array( "©m¦W", "¹q¸Ü", "¶Ç¯u", "¦a§}")
- .Activate
- End With
- AR = Array(0, 1, 2, 3, 6) 'AR = Array( 1, 2, 3, 6) '¤£n"ID"
- With CreateObject("InternetExplorer.Application")
- ' .Visible = True
- For i = 1 To Max_Id
- .Navigate ID & i
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- Application.StatusBar = ID & i & " ¸ü¤J..."
- t = Split(.Document.BODY.INNERTEXT, vbLf)
- If UBound(t) > -1 Then
- With Sh.Range("A" & Rows.Count).End(xlUp).Offset(1)
- .Select '¥i¤£¥Î
- For ii = 0 To 4 'For ii = 0 To 3 '¤£n"ID
- .Cells(1, ii + 1) = Split(t(AR(ii)), "¡G")(1)
- Next
- End With
- End If
- Next
- .Quit
- End With
- End Sub
- Function Max_Id() As Integer '¬d§ä³Ì·s·|ûªº·|¸¹
- Dim E As Object
- With CreateObject("InternetExplorer.Application")
- ' .Visible = True
- .Navigate "http://www.tyland.org.tw/pg.asp?theme=11"
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- For Each E In .Document.all.tags("A")
- If InStr(E.INNERTEXT, "³Ì«á¤@¶") Then
- E.Click '«ö¤U "³Ì«á¤@¶"
- Exit For
- End If
- Next
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- Set E = .Document.all.tags("table")(0).Rows
- Max_Id = E(E.Length - 1).Cells(1).INNERTEXT '³Ì·s·|ûªº·|¸¹
- .Quit 'Ãö³¬ºô¶
- End With
- End Function
½Æ»s¥N½X |
|