Hi Champion,

Below is a code that I found, can someone help me plot it in excel. I
am trying to paste data directly from excel to google translator, copy
the translated text from google and paste it in excel along side the
original text.

Assume:
1) A1 has the original text that needs to be translated
2) A2 has the language of original text
3) A3 has the languague in which I want the translation to happen
4) A4 is where I want to place the translated text.
5) I will be using a loop for my actual requirement and hence want to
use range instead of fixes hard coated values.

I searched the internet and this is the closest code that I have
found, at least this is what I think. Pls opine.

What I want to know is
1) How do I tweak the code to get my desired output
2) quality of the code
3) is it a code which is based on features available in excel or will
it require any downloads from the creater of this code. net net are
there any strings attached with this code.
4) help in understanding this code

Dim core As TwebstLib.ICoreVbaSet core = New TwebstLib.core
Dim browser As TwebstLib.IBrowserVba
Set browser = core.StartBrowserVba("http://www.google.com/";)
For i = 1 To 5
' Get the current text to be translated
Dim textToTranslate As String
textToTranslate = ActiveSheet.Cells(i, 1).Formula
' Twebst web automation part
Call browser.Navigate("http://www.google.com/language_tools?hl=en";)
Call browser.FindElementVba("textarea",
"id=source").InputText(textToTranslate)
Call browser.FindElementVba("select", "name=sl").Select("English")
Call browser.FindElementVba("select", "name=tl").Select("French")
Call browser.FindElementVba("input submit", "text=Translate").Click
' Find result span object
Dim resultObj As TwebstLib.IElementVba
Set resultObj = browser.FindElementVba("span", "id=result_box")
' Get the text result
Dim translatedText As String
translatedText = resultObj.Text
' Save the result into Excel sheet
ActiveSheet.Cells(i, 2).Formula = translatedText
Next

Regards,
Roopesh Kapur

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts

Reply via email to