Hello,
I am trying to translate a text in excel using googleapis.
When I type the URL:
"http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=Text+to+translate&langpair=en%7Cpt"
directly in the browser I get a text response:
{"responseData": {"translatedText":"Texto para traduzir"}, "responseDetails": null, "responseStatus": 200}
which has the translated text in it.
Now I am trying to automate this in Excel. How can I send the URL and catch the response? This is part of the code I have but when it gets to objHTTP.Send, it waits until the timeout and fails. Any idea?
vb.net Code:
Function fTranslate() As String Dim objHTTP As Object Dim URL As String Set objHTTP = CreateObject("Msxml2.ServerXMLHTTP.3.0") URL = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=Text+to+translate&langpair=en%7Cpt" objHTTP.Open "GET", URL, False objHTTP.setTimeouts 100000, 100000, 100000, 100000 objHTTP.send ("") fTranslate = objHTTP.ResponseText End Function
