outlook - How determine in which language an email is written using VBA


Keywords:vba 


Question: 

In My project, I would like to automate The following task in my work place :

  • Mails Triaging this task consist to read the email , detect the language of the email and send the email in particular folder in Outlook. lets say the Inbox have two emails one English and another in French .

the program should send the email for example to Jack EN for English emails and Julie FR For french emails.

So far I have this what I have :

Sub TriageEmails()
    Dim myolApp As Outlook.Application
    Dim aItem As Object 

    Set myolApp = CreateObject ("Outlook.Application")
    Set mail = myolApp.ActiveExplorer.CurrentFolder

    For Each AItem In mail.Items    
        `i guess the code will be here 
    Next aItem
End Sub

1 Answer: 

You can't. You might be able to detect the code page (as specified in the email headers - see MailItem.InternetCodepage property), but that tells you nothing about the language. And what do you do if there are multiple languages or code pages in the same email?

You can try to use IMultiLanguage3::DetectOutboundCodePage, but I don't think you can access IMultiLanguage in VBA.