Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Sub gTranslate(TextToTranslate As String, appLng As String) If appLng<>"e" Then text1$="Bitte wählen Sie einen zu übersetzenden Text aus." text2$="Übersetzer" lng$="de" dom$="de" Else text1$="Please select text to translate." text2$="Translator" lng$="en" dom$="com" End If TextToTranslate=Join(Split(TextToTranslate,Chr$(34)),"''") TextToTranslate=Join(Split(TextToTranslate,Chr$(10)),"LBREAK") TextToTranslate=Join(Split(TextToTranslate,Chr$(13)),"LBREAK") TextToTranslate=Join(Split(TextToTranslate,"LBREAKLBREAK"),"LBREAK") TextToTranslate =Join(Split(urlEncode(TextToTranslate),"LBREAK"), "%0D%0A") If TextToTranslate = "" Then MsgBox text1$, 48, text2$ Exit Sub End If ret= ShellExecute(0, "Open", "https://translate.google." & dom$ & "/?hl=" & lng$ & "#auto/" & lng$ & "/" & TextToTranslate , 0, 0, 1) End Sub
Call gTranslate(uidoc.GetSelectedText() ,"d")