[算表] 大量地址翻譯

作者: banao1995526 (凝)   2020-03-24 16:50:14
大家好
最近工作上需要大量的地址中翻英
上網爬文後看到之前有高手寫了函數轉換
但不知道為何我始終帶不出英文地址出來,都顯示Value,一類的我實在查不出個頭緒
以下為代入的函數,想起厲害的高手協助看看哪裡需要修正,謝謝!!
Public Function getCdit(strIn As Variant) As Variant
Dim objXML
Dim strResult As String
Dim strResultFin As String
Dim lngPosStart As Long
Dim lngPosEnd As Long
Set objXML = CreateObject("MSXML2.ServerXMLHTTP")
objXML.Open "GET", "http://cdict.net/?q=" & strIn, False
Call objXML.send
strResult = objXML.responseText
strResultFin = ""
lngPosStart = InStr(1, strResult, "<div id='eng_addr'>", vbTextCompare)
If lngPosStart > 0 Then
lngPosEnd = InStr(lngPosStart, strResult, "</div>", vbTextCompare)
strResultFin = Mid(strResult, lngPosStart + Len("<div
id='eng_addr'>"), lngPosEnd - lngPosStart - Len("<div id='eng_addr'>"))
End If
getCdit = strResultFin
Set objXML = Nothing
End Function
作者: soyoso (我是耀宗)   2020-03-24 17:13:00
測試巨集不用改,加個函數encodeurlhttps://i.imgur.com/wrLYcyU.jpg

Links booklink

Contact Us: admin [ a t ] ucptt.com