Kan iemand mij helpen voor het zoeken van een alternatief voor Google Translator?
Ik heb een vba code werken waar ik teksten vertaal van Nederlands naar Duits, Engels, Frans en Spaans.
Deze programma had ik al een tijdje niet meer gebruikt en vandaag kwam ik erachter dat Google Translator in december gestopt is met deze gratis service.
Mijn originele syntaxis is:
Public Function GoogleTranslate(strFromCountry As String, strToCountry As String, strText As String) As String
Dim cstrText As Long
Dim objHTML As Object
Dim objHTTP As Object
Dim strCharacter As String
Dim strTextConvert As String
Dim strRes As String
On Error GoTo ErrorDuringRunning
For cstrText = 1 To Len(strText)
strCharacter = Mid(strText, cstrText, 1)
Select Case strCharacter
Case "0" To "9", "A" To "Z", "a" To "z"
strTextConvert = strTextConvert & strCharacter
Case Else
strTextConvert = strTextConvert & "%" & Right("0" & Hex(Asc(strCharacter)), 2)
End Select
Next
strTemp = "http://translate.google.com/translate_a/t?client=t&text=" & strTextConvert & "&hl=en&sl=" & strFromCountry & "&tl=" & strToCountry & "&multires=1&pc=0&rom=1&sc=1"
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
Set objHTML = CreateObject("HTMLFILE")
On Error GoTo eerrr
With objHTTP
.Open "GET", strTemp, False
.send
strRes = .responseText
End With
GoogleTranslate = Replace(Replace(Split(strRes, ",")(0), "[", ""), """", "")
Set objHTTP = Nothing
Set objHTML = Nothing
ErrorDuringRunning:
If Err.number > 0 Then
strMessage = Err.number & " _ " & Err.Description
Debug.Print strTemp
End If
End Function
Ik heb een vba code werken waar ik teksten vertaal van Nederlands naar Duits, Engels, Frans en Spaans.
Deze programma had ik al een tijdje niet meer gebruikt en vandaag kwam ik erachter dat Google Translator in december gestopt is met deze gratis service.
Mijn originele syntaxis is:
Public Function GoogleTranslate(strFromCountry As String, strToCountry As String, strText As String) As String
Dim cstrText As Long
Dim objHTML As Object
Dim objHTTP As Object
Dim strCharacter As String
Dim strTextConvert As String
Dim strRes As String
On Error GoTo ErrorDuringRunning
For cstrText = 1 To Len(strText)
strCharacter = Mid(strText, cstrText, 1)
Select Case strCharacter
Case "0" To "9", "A" To "Z", "a" To "z"
strTextConvert = strTextConvert & strCharacter
Case Else
strTextConvert = strTextConvert & "%" & Right("0" & Hex(Asc(strCharacter)), 2)
End Select
Next
strTemp = "http://translate.google.com/translate_a/t?client=t&text=" & strTextConvert & "&hl=en&sl=" & strFromCountry & "&tl=" & strToCountry & "&multires=1&pc=0&rom=1&sc=1"
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
Set objHTML = CreateObject("HTMLFILE")
On Error GoTo eerrr
With objHTTP
.Open "GET", strTemp, False
.send
strRes = .responseText
End With
GoogleTranslate = Replace(Replace(Split(strRes, ",")(0), "[", ""), """", "")
Set objHTTP = Nothing
Set objHTML = Nothing
ErrorDuringRunning:
If Err.number > 0 Then
strMessage = Err.number & " _ " & Err.Description
Debug.Print strTemp
End If
End Function