+ Reply to Thread
Results 1 to 7 of 7

How to catch errors from Google Translate

  1. #1
    Registered User
    Join Date
    03-31-2014
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2211 Build 16.0.15831.20220) 64-bit
    Posts
    5

    How to catch errors from Google Translate

    Hi,
    I have created a macro translator (using help from this forum, so thanks) - a basic background is it reads through a number of rows in Column A, translates and puts the output in Column B. Basic but effective. It worked fine last week, I've not changed the code but now it's just returning blank data in Column B - I need to be able to check the return code/error code returned from the google translate and display a message if there's a problem but I've no idea how to do this - I've included the code in case it's any use......

    Please Login or Register  to view this content.
    I'm using the following test data in an excel spreadsheet:

    Verbatim
    I love this products but price is to high
    product ruined my marble worksurface
    dishwasher tablets are ruining my dishes
    Verbraucher kritisiert geändertes Produkt.
    Produkt muss mehrfach aufgetragen werden. Riecht nach Katzenurin.
    Riecht nach Duftstein!
    VB gefällt der Sprühnebem vom Produkt nicht.
    allergische Reaktion durch feinen Sprühnebel
    ich bekomme Atembeschwerden!
    Funktionert nicht
    Vb'in schreibt dass das Viss Produkt sie nicht überzeugen konnte.
    Ein permanentes Drehen des WC-Steins ist n. mögl. Verfärbungen Toilettenrand.
    Jetzige Flasche riecht anders und ist wässriger.





    Any help would be much appreciated as I'm supposed to be presenting this to my boss soon and I've told him it works!
    Cheers
    MrsMac

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: How to catch errors from Google Translate

    Your code worked fine for me - make sure that you have not renamed Sheet1 something else, since the code is looking for "Sheet1" - this version will work with the currently active sheet, no matter its name...

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 05-27-2014 at 10:14 AM.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    03-31-2014
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2211 Build 16.0.15831.20220) 64-bit
    Posts
    5

    Re: How to catch errors from Google Translate

    Hi Bernie,
    Thanks very much for taking the time to test this out - much appreciated. I've just tried it from scratch and run the debugger while doing it and it seems I'm getting a subscript out of range error on the UBound(CLEAN_DATA) having a value of -1, but I must admit to being a bit out of my depth now!

    Please Login or Register  to view this content.
    This is while translating the first "Verbatim" comment - how can I tell if I'm actually getting something returned from the translator in 'CLEAN_DATA' because I can't seem to see it using the debugger......
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: How to catch errors from Google Translate

    Just before that line, add a message box for debugging:

    Please Login or Register  to view this content.
    This is what I get for the first entry.....

    Capture.JPG

  5. #5
    Registered User
    Join Date
    03-31-2014
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2211 Build 16.0.15831.20220) 64-bit
    Posts
    5

    Re: How to catch errors from Google Translate

    Hi, This is what I get - Capture.PNG

    Can you see that attachment ok?
    Could there be a limit on the number of translations allowed or something daft like that? Since my code works for you, but doesn't work for me or anyone in my office, I'm starting to think it's something environmental here (or am cursed, one of the two!)......
    Does the call to the application have a return code I can check maybe? how can I find that out? (Sorry this is my first venture into non-mainframe coding so am a bit out of touch!)
    Thanks

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: How to catch errors from Google Translate

    Since you're violating google T&Cs and they charge for this, I suspect that they are applying restrictions. If you wish to use this commercially as you are doing then take a look at the unrestricted api here - along with pricing https://developers.google.com/translate/v2/pricing

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: How to catch errors from Google Translate

    What happens when you visit the site manually? You are not using their API, so I don't think those limits apply, but they may still be limiting based on your IP address.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. need Google Translate in Excel 2003
    By appu_gusai in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2013, 08:27 AM
  2. Catch non-existent dll compile errors
    By likestheaction in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2009, 08:07 PM
  3. Catch errors and exit gracefully
    By JWM6 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-03-2007, 08:21 PM
  4. how to catch errors from outlook
    By helpwithXL in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1