- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¥»©«³Ì«á¥Ñ c_c_lai ©ó 2015-12-12 07:51 ½s¿è
¦^´_ 3# brianhau
§Ú±N§Aªºµ{¦¡»P stillfish00 ¤j¤jªºµ{¦¡½X
²¤¥[¾ã¦X¦¨§Aªº»Ý¨D¡G- Private oxmlhttp As Object
- Private ohtml As Object
- Function searchITA(rng As Range)
- Dim XH As Object, shpRm As Shape
- Dim iurl, iurl2 As String
- Dim colNodes As Object, bFound As Boolean, oxford As String
-
- Columns("B:B").Select
- With Selection.Font
- .Name = "Arial Unicode MS"
- .Size = 12
- End With
- ' ²M°£¤w¦³ªº¸ÑÄÀ¤Îµ¼Ð
- Range("B:J").Clear
- Range("a1").Select
-
- iurl = "http://tw.dictionary.search.yahoo.com/search?p="
- iurl2 = "http://dict.tw/index.pl?query="
- For Each rng In ActiveSheet.Range("a1", ActiveSheet.Range("a50").End(xlUp))
- rng.Select
- If rng.Value <> "" Then
- rng.Select
- Set XH = CreateObject("Microsoft.XMLHTTP")
- With XH
- .Open "get", iurl & rng, False
- .send
- ' On Error Resume Next
- ' ±qYahoo¦r¨åºK¨ú²Ä¤@²Õ¤¤¤å½Ķ
- If InStr(.responseText, "><h4>1.") > 0 Then rng.Offset(0, 2) = Trim(Split(Split(.responseText, "><h4>1.")(1), "<")(0))
- ' ºK¨úKKµ¼Ð
- If InStr(.responseText, ">KK[") > 0 Then rng.Offset(0, 1) = "[" & Split(Split(.responseText, ">KK[")(1), "]")(0) & "]"
- .Open "get", iurl2 & rng, False
- .send
- ' ±q DICT.TW ^º~¦r¨åÂ^¨ú¦r¸q
- If InStr(.responseText, "</span><br /> ") > 0 Then rng.Offset(0, 3) = Split(Split(.responseText, "</span><br /> ")(1), "<")(0)
- End With
- If oxmlhttp Is Nothing Then Set oxmlhttp = CreateObject("msxml2.xmlhttp")
- If ohtml Is Nothing Then Set ohtml = CreateObject("htmlfile")
-
- With oxmlhttp
- .Open "get", "http://www.oxfordlearnersdictionaries.com/definition/english/" & rng, False
- .send
- ohtml.body.innerhtml = .responseText
-
- ' <span class="def" ...
- Set colNodes = ohtml.getElementsByTagName("span")
- For Each x In colNodes
- If x.className = "def" Then bFound = True: oxford = x.innerText: Exit For
- Next
- If Not bFound Then oxford = "# Not Found #"
- End With
- rng.Offset(0, 9) = oxford
- End If
- Next
- End Function
½Æ»s¥N½X- Sub Ex()
- searchITA ([A1])
- End Sub
½Æ»s¥N½X |
|