# Change Translator to Bing Microsoft Translator



## boboyj (Oct 11, 2018)

I have been using Google Translate in my VBA code Function which is working perfectly fine for me.  However, I have noticed that the translation they have for ARABIC is not as accurate as that with Bing Microsoft Translator which makes me decide to replace my current translator in the function with this.  However, I am somehow unable to generate the same result using the link for Bing Microsoft Translator in the code itself.  
Please can someone help me modify the code in the below function I am using.


```
Private Function Translate_using_vba(str As String) As String
' Tools Refrence Select Microsoft internet Control
    Dim IE As Object, i As Long, j As Long
    Dim inputstring As String, outputstring As String, text_to_convert As String, result_data As String, CLEAN_DATA
    Set IE = CreateObject("InternetExplorer.application")
    '   TO CHOOSE INPUT LANGUAGE
    inputstring = "ar"
    '   TO CHOOSE OUTPUT LANGUAGE
    outputstring = "en"
    text_to_convert = str
    
    'open website
    IE.Visible = False
   
 IE.Navigate "https://translate.google.com/?hl=en&tab=wT/#" & inputstring & "/" & outputstring & "/" & text_to_convert
   
   'I want to replace above line with the below but this doesn't work.
   'IE.Navigate "https://www.bing.com/translator/?ref=TThis&&text=&from=&to=en/#" & inputstring & "/" & outputstring & "/" & text_to_convert
 
   Do Until IE.ReadyState = 4
        DoEvents
    Loop
    Application.Wait (Now + TimeValue("0:00:5"))
    Do Until IE.ReadyState = 4
        DoEvents
    Loop
    CLEAN_DATA = Split(Application.WorksheetFunction.Substitute(IE.Document.getElementById("result_box").innerHTML, "", ""), "<")
    For j = LBound(CLEAN_DATA) To UBound(CLEAN_DATA)
        result_data = result_data & Right(CLEAN_DATA(j), Len(CLEAN_DATA(j)) - InStr(CLEAN_DATA(j), ">"))
    Next
    IE.Quit
    Translate_using_vba = result_data
End Function
```
Thank you so much for the assistance.


----------

