返回列表 上一主題 發帖

[發問] 地址翻譯匯入與匯出

因工作需要,要把地址中翻英輸入翻譯網址http://cdict.net/ 或中華郵政 (因需下拉故放棄)
資料約2000多筆, ...
paddyliu 發表於 2012-11-5 15:05


不好意思, 慢了

只要http://cdict.net/ 不改版, 也可以用的.
  1. Public Function getCdit(strIn As Variant) As Variant
  2.     Dim objXML
  3.     Dim strResult As String
  4.     Dim strResultFin As String
  5.     Dim lngPosStart As Long
  6.     Dim lngPosEnd As Long
  7.    
  8.     Set objXML = CreateObject("MSXML2.ServerXMLHTTP")
  9.     objXML.Open "GET", "http://cdict.net/?q=" & strIn, False
  10.     Call objXML.send
  11.     strResult = objXML.responseText
  12.     strResultFin = ""
  13.     lngPosStart = InStr(1, strResult, "<div id='eng_addr'>", vbTextCompare)
  14.     If lngPosStart > 0 Then
  15.         lngPosEnd = InStr(lngPosStart, strResult, "</div>", vbTextCompare)
  16.         strResultFin = Mid(strResult, lngPosStart + Len("<div id='eng_addr'>"), lngPosEnd - lngPosStart - Len("<div id='eng_addr'>"))
  17.     End If
  18.     getCdit = strResultFin
  19.     Set objXML = Nothing
  20. End Function
複製代碼
懂得發問,答案就會在其中

今日の一秒は  明日にない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

        靜思自在 : 人要知福、惜福、再造福。
返回列表 上一主題