![]() ![]() Public Function AutoTranslate(ByVal Text As String, Optional LanguageFrom As LanguageCode, Optional LanguageTo As LanguageCode2) As Stringĭim langFrom As String, langTo As String, IE As InternetExplorer, URL As String, myArray MsgBox AutoTranslate(msg, InputEnglish, ReturnSpanish)įunction. Keep in mind, there's a character limit of around 3000 or so with google translate, and also, you must set IE=nothing especially if you will be using this multiple times, otherwise you will create multiple IE processes and eventually it won't work anymore. And finally, to get rid of having to clean up the output, I just used. Also, in this sample I selected the Microsoft Internet Controls reference so instead of creating an object, there's an InternetExplorer object used. ![]() For simplicity I only included a few language codes. It's function with optional enumeration objects that point to language codes used by google translate. IE.navigate "" & inputstring & "/" & outputstring & "/" & text_to_convertĪpplication.Wait (Now + TimeValue("0:00:5"))ĬLEAN_DATA = Split((IE.Document.getElementById("result_box").innerHTML, "", ""), "")) Set IE = CreateObject("InternetExplorer.application") ' Tools Refrence Select Microsoft internet Controlĭim inputstring As String, outputstring As String, text_to_convert As String, result_data As String, CLEAN_DATA ![]() Function translate_using_vba(str) As String ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |