VBAmacros – 在Excel中自动翻译我的文本

我目前正在使用Microsoft Document Translator翻译我的文本。 是否有可能使用VBAmacros自动翻译它?

谢谢。

我试图解决类似的问题,并find代码实施它,以满足我的需要希望它也可以帮助你。

Sub runner() Dim conversion As String conversion = "hello world" MsgBox translate(conversion) End Sub Function translate(text As String) ' Tools Refrence Select Microsoft internet Control Dim IE As Object, i As Long Dim inputstring As String, outputstring As String, text As String, result_data As String, CLEAN_DATA Set IE = CreateObject("InternetExplorer.application") 'choose input language automatic recognition in example inputstring = "auto" 'choose output language czech in example outputstring = "cs" 'open google translate IE.Visible = False IE.navigate "http://translate.google.com/#" & inputstring & "/" & outputstring & "/" & text Do Until IE.ReadyState = 4 DoEvents Loop Application.Wait (Now + TimeValue("0:00:1")) 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 transalte = result_data End Function