- ©«¤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 09:46 ½s¿è
¦^´_ 2# Michelle-W
google ·|¦³¬y¶qºÞ¨î¨î¸ê®Æªº¤U¸ü
¸Õ¸Õ¬Ý- Option Explicit
- Sub ¸ê®Æ·j´M()
- Dim IE As Object, MyState As String, E As Object
- Dim Sh As Worksheet, Msg As Boolean, i As Integer
- With Workbooks.Open(ThisWorkbook.Path & "\¸ê®Æ³B²z.xlsm") '¥´¶}¥t¤@Óexcel°µ¬°¸ê®ÆÀx¦s
- Set Sh = .Sheets("SHEET2")
- Sh.Cells.Clear
- End With
- Set IE = CreateObject("InternetExplorer.Application")
- With IE
- .Visible = True 'False
- .Navigate ("https://www.google.com")
- End With
- MyState = ThisWorkbook.Sheets("sheet1").Range("A2") 'B2¬°ÃöÁä¦r,¥´¶}IE
- While IE.Busy Or IE.readyState <> 4: DoEvents: Wend '½T«Oºô¶§¹¾ã¥´¶}
- For Each E In IE.Document.getelementsbytagname("input")
- If E.Name = "q" Then: E.Value = MyState: Exit For '§ä¨ìinput,¶ñ¤J¿é¤JÈ
- Next
- While IE.Busy Or IE.readyState <> 4: DoEvents: Wend '½T«Oºô¶§¹¾ã¥´¶}
- IE.Document.getElementsByName("btnG").Item.Click '«ö¤U·j´M¯Ã
- ag: '¤U¸ü·j´Mµ²ªG
- Msg = False
- While IE.Busy Or IE.readyState <> 4: DoEvents: Wend '½T«Oºô¶§¹¾ã¥´¶}
- 'FnWait (0.7) 'µ¥«Ý®É¶¡ :µ¥Ôºô¶¾ã²z§¹²¦
- Do While IE.Busy: DoEvents: Loop
- For Each E In IE.Document.ALL.TAGS("H3")
- i = i + 1
- Sh.Cells(Sh.Range("A" & Sh.Rows.Count).End(xlUp).Row + 1, 1) = E.ALL(0).innertext
- Sh.Cells(Sh.Range("B" & Sh.Rows.Count).End(xlUp).Row + 1, 2) = E.ALL(0).HREF
- Application.StatusBar = E.ALL(0).innertext
- Next
- For Each E In IE.Document.ALL.TAGS("span")
- If E.innertext = "¤U¤@¶" Then
- Msg = True
- E.Click
- Exit For
- End If
- Next
- If Msg Then GoTo ag
- If IE.LocationURL Like "https://ipv4.google.com/sorry/IndexRedirect?*" Then '** ³Q google ¬y¶qºÞ¨î
- MsgBox "½Ð¥ý¨ì IE ¿é¤J:ÅçÃҼƦr,¦A¦^¨ìExcel «ö¤U½T©wÁä ", , "google ¬y¶qºÞ¨î"
- GoTo ag
- End If
- Application.StatusBar = MyState & " ¦@ google " & i
- IE.Quit
- End Sub
-
½Æ»s¥N½X |
|