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

¤Wºô¬d­µ¼Ð­^­^¸ÑÄÀ

¤Wºô¬d­µ¼Ð­^­^¸ÑÄÀ

­è­èª¦¤F¤@¤U¤å
¥Î¿ùªºµ{¦¡½X¥X²{¤FVB½s¿è¾¹
³o¼Ë§Ú·ÓµÛ¸Õ¸Õ¡A¦¨¥\¤F


½Ð±Ð«e½ú­Y¬O§Ú·Q­n´¡¤J¤@ÄæÂ^¨ú­^­^ªº¸ÑÄÀ­n«ç»ò°µ©O¡H
¨Ò¦p±q
http://www.oxfordlearnersdictionaries.com/definition/english/?q=
¤¤Â^¨ú²Ä¤@¦æ­^­^¸ÑÄÀ


§Ú¸ÕµÛ§ï°Êµ{¦¡½X¦ý¨S¦³¥ô¦ó¤ÏÀ³
Sub searchIT(rng As Range)
    Dim XH As Object
    Dim shpRm As Shape
    Columns("B:B").Select
    With Selection.Font
        .Name = "Arial Unicode MS"
        .Size = 12
    End With
Range("a1").Select
      Dim iurl, iurl2 As String
    '²M°£¤w¦³ªº¸ÑÄÀ¤Î­µ¼Ð
    iurl = "http://www.oxfordlearnersdictionaries.com/definition/english/?q="
    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
                        '±qDICT.TW ­^º~¦r¨åÂ^¨ú¦r¸q
                        If InStr(.responseText, "</span><br /> &nbsp;") > 0 Then rng.Offset(0, 3) = Split(Split(.responseText, "</span><br /> &nbsp;")(1), "<")(0)
                    End With
             End If
    Next
End Sub

¦^´_ 1# brianhau
¥Î¿ùªºµ{¦¡½X¥X²{¤FVB½s¿è¾¹
³o¼Ë§Ú·ÓµÛ¸Õ¸Õ¡A¦¨¥\¤F

1.  ÀÉ®×>¿ï¶µ>¦Û­q¥\¯à°Ï¤Ä¿ï¶}µo¤H­û¡A¥H«á´N¦³«ö¶sª½±µ¶i¥h¤F...
©Î¬O§Ö³tÁä Alt+ F11
   
2.  ¨C­Óºô­¶³£¬O¤£¤@¼Ëªº¡A­ìµ{¦¡¬O°w¹ï©_¼¯¦r¨åªººô­¶¤ÀªRÂ^¨úµ²ªGªº¡A§A¥u´«ºô§}¡A¤ÀªRÅÞ¿è³£¨SÅÜ·íµM¤£¯à¥Î...

3.  ­^­^¦r¨åªº¦Û­q¨ç¼Æ
  1. Private oxmlhttp As Object
  2. Private ohtml As Object
  3. Function dictionary_oxford(word As String)
  4.     Dim colNodes As Object, bFound As Boolean
  5.         
  6.     If oxmlhttp Is Nothing Then Set oxmlhttp = CreateObject("msxml2.xmlhttp")
  7.     If ohtml Is Nothing Then Set ohtml = CreateObject("htmlfile")
  8.    
  9.     With oxmlhttp
  10.         .Open "get", "http://www.oxfordlearnersdictionaries.com/definition/english/" & word, False
  11.         .send
  12.         ohtml.body.innerhtml = .responsetext
  13.         
  14.         '<span class="def" ...
  15.         Set colNodes = ohtml.getElementsByTagName("span")
  16.         For Each x In colNodes
  17.             If x.className = "def" Then bFound = True: dictionary_oxford = x.innerText: Exit For
  18.         Next
  19.         If Not bFound Then dictionary_oxford = "# Not Found #"
  20.     End With
  21. End Function
½Æ»s¥N½X
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 2# stillfish00

ÁÂÁ«e½ú«ü¾É
§Ú¬ã¨s¤F¤@¤U
¤´¥X²{³o¼Ëªº¿ù»~°T®§

½Ð°Ý§Ú­þ¸Ì°µ¿ù¤F¶Ü¡H
dict Eng.zip (15.72 KB)
ªþ¥ó¬O§Ú¬ã¨s«áªºµ²ªG¡A½Ð«e½ú«ü¾É¡C

½Ð°Ý¥i§_±ÀÂËVBªº¤Jªù®ÑÄy¡H¸Õ¿ù«áı±o«Ü¦³½ì·QÁA¸Ñ¡AÁÂÁ¦U¦ì«e½ú¡C

TOP

¦^´_ 3# brianhau
·s¼W·sªºModule¡A¶K¤W2# code
¤u§@ªí A1 ¶ñ§A­n¬dªº¦r
            B1 ¶ñ =dictionary_oxford(A1)

ºô­¶Â^¨ú¬ÛÃöªº´Nºâ¬O¶i¶¥®Ñ¤]¤£·|±Ð§Aªº
¤Jªù®Ñ¨ì®Ñ©±Â½Â½¬Ý¾A¦X¦Û¤vµ{«×ªº·|¤ñ¸û¦n¡C
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2015-12-12 07:51 ½s¿è

¦^´_ 3# brianhau
§Ú±N§Aªºµ{¦¡»P stillfish00 ¤j¤jªºµ{¦¡½X
²¤¥[¾ã¦X¦¨§Aªº»Ý¨D¡G
  1. Private oxmlhttp As Object
  2. Private ohtml As Object

  3. Function searchITA(rng As Range)
  4.     Dim XH As Object, shpRm As Shape
  5.     Dim iurl, iurl2 As String
  6.     Dim colNodes As Object, bFound As Boolean, oxford As String
  7.      
  8.     Columns("B:B").Select
  9.     With Selection.Font
  10.          .Name = "Arial Unicode MS"
  11.          .Size = 12
  12.     End With
  13.     '  ²M°£¤w¦³ªº¸ÑÄÀ¤Î­µ¼Ð
  14.     Range("B:J").Clear
  15.     Range("a1").Select
  16.      
  17.     iurl = "http://tw.dictionary.search.yahoo.com/search?p="
  18.     iurl2 = "http://dict.tw/index.pl?query="
  19.     For Each rng In ActiveSheet.Range("a1", ActiveSheet.Range("a50").End(xlUp))
  20.         rng.Select
  21.         If rng.Value <> "" Then
  22.             rng.Select
  23.             Set XH = CreateObject("Microsoft.XMLHTTP")
  24.             With XH
  25.                 .Open "get", iurl & rng, False
  26.                 .send
  27.                 '  On Error Resume Next
  28.                 '  ±qYahoo¦r¨åºK¨ú²Ä¤@²Õ¤¤¤å½Ķ
  29.                  If InStr(.responseText, "><h4>1.") > 0 Then rng.Offset(0, 2) = Trim(Split(Split(.responseText, "><h4>1.")(1), "<")(0))
  30.                 '  ºK¨úKK­µ¼Ð
  31.                 If InStr(.responseText, ">KK[") > 0 Then rng.Offset(0, 1) = "[" & Split(Split(.responseText, ">KK[")(1), "]")(0) & "]"
  32.                 .Open "get", iurl2 & rng, False
  33.                 .send
  34.                 '  ±q DICT.TW ­^º~¦r¨åÂ^¨ú¦r¸q
  35.                 If InStr(.responseText, "</span><br /> &nbsp;") > 0 Then rng.Offset(0, 3) = Split(Split(.responseText, "</span><br /> &nbsp;")(1), "<")(0)
  36.             End With
  37.             If oxmlhttp Is Nothing Then Set oxmlhttp = CreateObject("msxml2.xmlhttp")
  38.             If ohtml Is Nothing Then Set ohtml = CreateObject("htmlfile")
  39.    
  40.             With oxmlhttp
  41.                 .Open "get", "http://www.oxfordlearnersdictionaries.com/definition/english/" & rng, False
  42.                 .send
  43.                 ohtml.body.innerhtml = .responseText
  44.         
  45.                 '  <span class="def" ...
  46.                 Set colNodes = ohtml.getElementsByTagName("span")
  47.                 For Each x In colNodes
  48.                     If x.className = "def" Then bFound = True: oxford = x.innerText: Exit For
  49.                 Next
  50.                 If Not bFound Then oxford = "# Not Found #"
  51.            End With
  52.            rng.Offset(0, 9) = oxford
  53.         End If
  54.     Next
  55. End Function
½Æ»s¥N½X
  1. Sub Ex()
  2.     searchITA ([A1])
  3. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2015-12-14 07:33 ½s¿è

¦^´_ 3# brianhau
¥ç¥i¥H´©¥Î­ì¥»ªº¤è¦¡¡A§Y
¨Ï¥Î¤À§O¤§¨â­Ó¦Û­q¨ç¦¡¡G
  1. Private oxmlhttp As Object
  2. Private ohtml As Object

  3. Function dictionary_oxford(word As String)
  4.     Dim colNodes As Object, bFound As Boolean
  5.         
  6.     If oxmlhttp Is Nothing Then Set oxmlhttp = CreateObject("msxml2.xmlhttp")
  7.     If ohtml Is Nothing Then Set ohtml = CreateObject("htmlfile")
  8.    
  9.     With oxmlhttp
  10.         .Open "get", "http://www.oxfordlearnersdictionaries.com/definition/english/" & word, False
  11.         .send
  12.         ohtml.body.innerhtml = .responseText
  13.         
  14.         '  <span class="def" ...
  15.         Set colNodes = ohtml.getElementsByTagName("span")
  16.         For Each x In colNodes
  17.             If x.className = "def" Then bFound = True: dictionary_oxford = x.innerText: Exit For
  18.         Next
  19.         If Not bFound Then dictionary_oxford = "# Not Found #"
  20.     End With
  21. End Function
½Æ»s¥N½X
  1. Sub Ex()
  2.     Dim txt As String
  3.    
  4.     '  txt = dictionary_oxford("simulation")
  5.     '  MsgBox "simulation = " & txt
  6.     searchIT ([A1])
  7. End Sub
½Æ»s¥N½X
  1. Function searchIT(rng As Range)
  2.     Dim XH As Object, shpRm As Shape
  3.     Dim iurl, iurl2 As String
  4.      
  5.     Columns("B:B").Select
  6.     With Selection.Font
  7.          .Name = "Arial Unicode MS"
  8.          .Size = 12
  9.     End With
  10.    
  11.     Range("B:J").Clear
  12.     Range("a1").Select
  13.     '  ²M°£¤w¦³ªº¸ÑÄÀ¤Î­µ¼Ð
  14.     iurl = "http://tw.dictionary.search.yahoo.com/search?p="
  15.     iurl2 = "http://dict.tw/index.pl?query="
  16.     For Each rng In ActiveSheet.Range("a1", ActiveSheet.Range("a50").End(xlUp))
  17.         rng.Select
  18.         If rng.Value <> "" Then
  19.             rng.Select
  20.             Set XH = CreateObject("Microsoft.XMLHTTP")
  21.             With XH
  22.                 .Open "get", iurl & rng, False
  23.                 .send
  24.                 '  On Error Resume Next
  25.                 '  ±qYahoo¦r¨åºK¨ú²Ä¤@²Õ¤¤¤å½Ķ
  26.                 If InStr(.responseText, "><h4>1.") > 0 Then rng.Offset(0, 2) = Trim(Split(Split(.responseText, "><h4>1.")(1), "<")(0))
  27.                 '  ºK¨úKK­µ¼Ð
  28.                 If InStr(.responseText, ">KK[") > 0 Then rng.Offset(0, 1) = "[" & Split(Split(.responseText, ">KK[")(1), "]")(0) & "]"
  29.                 .Open "get", iurl2 & rng, False
  30.                 .send
  31.                 '  ±qDICT.TW ­^º~¦r¨åÂ^¨ú¦r¸q
  32.                 If InStr(.responseText, "</span><br /> &nbsp;") > 0 Then rng.Offset(0, 3) = Split(Split(.responseText, "</span><br /> &nbsp;")(1), "<")(0)
  33.             End With
  34.             rng.Offset(0, 9) = dictionary_oxford(rng.Value)
  35.         End If
  36.     Next
  37. End Function
½Æ»s¥N½X
¦p¦¹µ²ªGÀ³¸Ó¬O§Aºc·Qªº¤è¦¡¤F¡C

TOP

¦^´_ 4# stillfish00
ÁÂÁÂstillfish00ªº¦^ÂÐ
¦ý§ÚÁÙ¸Õ¸Õ¤£¥X¨Ó...

TOP

¦^´_ 6# c_c_lai
ÁÂÁÂc_c_lai¡A«D±`·P¿E¡I
§Ú¸ÕµÛ¶K¤Wµ{¦¡½X¡Aµo²{§¹¥þ¤£·|°Ê§@¡A¬O¤í¯Ê¤°»ò¨BÆJ¶Ü¡H
¦A¦¸ÁÂÁ±z¡I
dict Eng.rar (12.03 KB)

TOP

¦^´_ 8# brianhau
§A¥Ø«eªº¡y¼Ò²Õ¡z¤À§O¬° Module1¡BModule2¡BModule3¡A
¥H¤U¬O§A¥Ø«eµ{¦¡©ñ¸mªº¤º®e¡G
Module1 Â\©ñªº¬O Function dictionary_oxford(word As String)¡A
Module2 Â\©ñªº¬O Sub Ex() ´ú¸Õ¼Ò²Õ (¥Dµ{¦¡)¡A
Module3 Â\©ñªº¬O Function searchIT(rng As Range)
§A¥u­n°õ¦æ ¡y¼Ò²Õ -> Module2 -> Ex¡z´N¦æ¤F¡C
©ÎªÌ¬O (¥¿¦¡¹B§@®É)
§A¥i¥H´¡¤J¡yButton¡zª«¥ó¡A«ü¨ì§Aªº ¡y¼Ò²Õ -> Module2 -> Ex¡z¡C

TOP

¦^´_ 8# brianhau
¦p«e­±©Ò­z¡A§A¥i¥H¿ï¾Ü°õ¦æ
(A) searchIT ([A1]) ¥ç©Î¬O
(B) searchITA ([A1])¡C

(A) ¼Ò¦¡«Y±N¨ç¥Ü¤À¬°¨â­Ó¨ç¦¡³B¸Ì¤£¦P¤º®e¡G
    A-1.  Function searchIT(rng As Range)
          ±q Yahoo ¦r¨åºK¨ú²Ä¤@²Õ KK ­µ¼Ð¡B¤¤¤å½Ķ
    A-2.  Function dictionary_oxford(word As String)
          §ì¨ú¹ïÀ³¤§¤û¬z­^Ãã¸ÑÄÀ¡C
(B) ¼Ò¦¡«Y±N¨ç¥Ü¦X¦Ó¬°¤@¡A¥H¤@­Ó¨ç¦¡³B¸Ì A-1 ¥H¤Î A-2
    ¤£¦P§@·~¤º®e¡G
    B.  Function searchITA(rng As Range)

¾Ü¤@°õ¦æ¡A¥i¨Ì§A­Ó¤H³ß¦n¿ï¾Ü¡AA ®×«Y¨Ì³B¸Ì¤£¦P¤º®e¡A¦Ó
¦³¨ä¦U¦Ûªº¨ç¦¡¥]¸Ë¡A¨Æ«á¥i¨Ì¨ä¥¦¹ê°È»Ý¨D©ö©ó²Õ¦X¥]¸Ë¡F
B ®×«Y¬°¾ã¦X¦¡¨ç¦¡¡C)

§A¥i±Nµ{¦¡¥þ³¡¸m©ñ©ó¡y¼Ò²Õ -> Module1¡z¤º¡A©Î¬O±N Ex()
³æ¿W©â¥X¨Ó¥t©ñ¸m¦b ThisWorkbook ªºµ{¦¡½X°Ï¤º¡F©ÎªÌ¬O
±N©Ò¦³µ{¦¡½X¥þ³¡¸Ë¸m¦b  ThisWorkbook ªºµ{¦¡½X°Ï¤º¡C

¦bµ{¦¡½X³Ì«e­±¦pªG§A¥[¤J¤F ¡yOption Explicit¡z¡A
·N§Y§A«Å§i¤F©Ò¦³¨Ï¥Î¤§ÅܼƻÝÀ³¡u¨Æ¥ý¥[¥H«Å§i¡vªº­ì¦]¡C
¦]¬°¦b dictionary_oxford ¨ç¦¡¨Ã¥¼«Å§i x ªºÅܼƫ¬ºA¡A
§A¥u­n¥[¤J«¬ºA«Å§i (x As Variant) §Y¥i¡C

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¯Ê¤fªºªM¤l¡A¦pªG´«¤@­Ó¨¤«×¬Ý¥¦¡A¥¦¤´µM¬O¶êªº¡C
ªð¦^¦Cªí ¤W¤@¥DÃD