locked
VBA translation function RRS feed

  • Question

  • I want to create a simple vba function (in MS Project...) to translate on demand. I have a simple one I found on the web, but it returns question marks instead of the Chinese translation. I assume this is a "code page" issue or something like that. Can anyone help?

    Sub bingTranslate()
     languageFrom = "en": languageTo = "zh-chs": sText = "Thank you"
     ID = "708BEDCB01828123DC7B6C6A6AB12EF82DFBB611"
    sURL = "http://api.microsofttranslator.com/V2/Ajax.svc/Translate?oncomplete=&appId=" & ID + "&from=" & languageFrom + "&to=" & languageTo & "&text=" & sText
      Set oH = CreateObject("Microsoft.XMLHTTP")
      oH.Open "get", sURL, False
      oH.sEnd
      sresult = oH.responseText
      MsgBox oH.responseText
      Debug.Print sresult
    End Sub

    Thanks in advance.

    Jim

    Monday, May 14, 2012 6:26 AM

Answers

  • The Bing AppID methodology has been deprecated. You'll have to use the Windows Azure Marketplace tokens to access translator.

    I have a VB (not VBA) sample here:

    http://social.msdn.microsoft.com/Forums/en-US/microsofttranslator/thread/3f9a270e-3360-4aa1-9eb8-669145298d45

    Hope that helps! :)



    //Laurence Moroney: www.netnavi.tv // Author of 'Introducing Silverlight' series and much more // @lmoroney



    • Edited by 祥皓 Tuesday, May 15, 2012 3:29 PM
    • Proposed as answer by 祥皓 Tuesday, May 15, 2012 3:30 PM
    • Marked as answer by JimS-Indy Wednesday, July 11, 2012 9:03 AM
    Tuesday, May 15, 2012 3:29 PM

All replies

  • The Bing AppID methodology has been deprecated. You'll have to use the Windows Azure Marketplace tokens to access translator.

    I have a VB (not VBA) sample here:

    http://social.msdn.microsoft.com/Forums/en-US/microsofttranslator/thread/3f9a270e-3360-4aa1-9eb8-669145298d45

    Hope that helps! :)



    //Laurence Moroney: www.netnavi.tv // Author of 'Introducing Silverlight' series and much more // @lmoroney

    Tuesday, May 15, 2012 2:28 PM
  • The Bing AppID methodology has been deprecated. You'll have to use the Windows Azure Marketplace tokens to access translator.

    I have a VB (not VBA) sample here:

    http://social.msdn.microsoft.com/Forums/en-US/microsofttranslator/thread/3f9a270e-3360-4aa1-9eb8-669145298d45

    Hope that helps! :)



    //Laurence Moroney: www.netnavi.tv // Author of 'Introducing Silverlight' series and much more // @lmoroney



    • Edited by 祥皓 Tuesday, May 15, 2012 3:29 PM
    • Proposed as answer by 祥皓 Tuesday, May 15, 2012 3:30 PM
    • Marked as answer by JimS-Indy Wednesday, July 11, 2012 9:03 AM
    Tuesday, May 15, 2012 3:29 PM