(Solved) – microsoft excel new vba with bing translator

  • by
(solved)-–-microsoft-excel-new-vba-with-bing-translator

I think the bing translation site is successful from google sheets. I have written something in my own way but I am getting errors. Can you help me with that?

enter image description here

https://www.bing.com/translator?from=en&to=tr

Public Function TERCUME(kelime As Range, FROM As String, TO As String)

Dim IE As New InternetExplorer
Dim doc As HTMLDocument


fromto = "from=" & FROM & "&to=" & TO
'https://www.bing.com/translator?from=en&to=tr'
IE.navigate "https://www.bing.com/translator?" & fromto & "&setlang=tr"
IE.Visible = False

Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE

Set doc = IE.document
Set kelimex = doc.getElementsById("tta_input_ta")(0)
kelimex.Value = kelime

Set cevap = doc.getElementsById("tta_output_ta")(0)
TERCUME = cevap.innerText

IE.Quit
Set IE = Nothing
End Function

Update//

I updated my question and finally I getting this;#DEGER!(#Value!).

enter image description here

Public Function TERCUME(kelime As Range, giris As String, cikis As String)

Dim ie As New InternetExplorer
Dim doc As HTMLDocument


fromto = "from=" & giris & "&to=" & cikis
'https://www.bing.com/translator?from=en&to=tr'
ie.navigate "https://www.bing.com/translator?" & fromto
ie.Visible = False

Do
DoEvents
Loop Until ie.readyState = READYSTATE_COMPLETE

Set doc = ie.document
Set kelimex = doc.getElementsById("tta_input_ta")(0)
kelimex.Value = kelime

beklet (2)

Set cevap = doc.getElementsById("tta_output_ta")(0)
TERCUME = cevap.innerText

ie.Quit
Set ie = Nothing
End Function

Public Function beklet(beklemezamani As Double)
Start = Timer
Do
DoEvents
Loop Until (Timer - Start) >= beklemezamani
End Function

Leave a Reply

Your email address will not be published. Required fields are marked *