0
通過這個鏈接[Excel Function To Convert English Names To Arabic]我試着去適應下面的代碼從阿拉伯名字翻譯成英文Excel函數轉換阿拉伯名字英文
Function Translate_To_English (Rng As Range) As String
' Tools Refrence Select Microsoft internet Control
Dim IE As Object, i As Long
Dim inputstring As String, outputstring As String, text_to_convert As String, result_data As String, CLEAN_DATA
Set IE = CreateObject("InternetExplorer.application")
' TO CHOOSE INPUT LANGUAGE
inputstring = "ar"
' TO CHOOSE OUTPUT LANGUAGE
outputstring = "en"
text_to_convert = Rng.Text
'open website
IE.Visible = False
IE.navigate "http://translate.google.com/#" & inputstring & "/" & outputstring & "/" & text_to_convert
Do Until IE.ReadyState = 4
DoEvents
Loop
Application.Wait (Now + TimeValue("0:00:5"))
Do Until IE.ReadyState = 4
DoEvents
Loop
CLEAN_DATA = Split(Application.WorksheetFunction.Substitute(IE.Document.getElementById("result_box").innerHTML, "</SPAN>", ""), "<")
For j = LBound(CLEAN_DATA) To UBound(CLEAN_DATA)
result_data = result_data & Right(CLEAN_DATA(j), Len(CLEAN_DATA(j)) - InStr(CLEAN_DATA(j), ">"))
Next
IE.Quit
Translate_To_English = result_data
End Function`
,但它沒有工作,說錯誤
請幫忙嗎?
」 ......這沒的年齡沒有工作「。它怎麼不工作?有什麼地方出現錯誤(如果是這樣,什麼錯誤,在哪裏)?它運行嗎,但沒有任何反應?它運行但得到不正確的翻譯? ...等等。 – BruceWayne
谷歌翻譯有一個API,你可以使用,而不是一個IE對象。 – Jeeped