What reference do I need to use MAPI to send mail from VBA?

Eman picture Eman · Jul 14, 2011 · Viewed 11.3k times · Source

I'm trying to send a report to people through Access Database (SendObject VB code). It has been successul until we rollout Microsoft Outlook 2010 last November.

Since the upgrade, we can't send the report out anymore. We are getting a compile Error message: "User-defined type not defined" with "MAPISession As MAPI.Session" HIGHLIGHTED in blue.

error

I'm guessing this might be a reference issue, so I went in Tools\References then click on "Messenger API Type Library" hoping it will help, but it didn't help. Still getting the same error message.

Could anyone advise me on what to do next?

Answer

Dmitry Streblechenko picture Dmitry Streblechenko · Jul 15, 2011

This is CDO 1.21. It is an optional component in Outlook 2007. Outlook 2010 does not install it at all. You can download it from http://www.microsoft.com/download/en/details.aspx?id=3671 Keep in mind that it only comes in 32 bit and has not been updated (functionality wise) for the last 10 years. Other alternatives are Extended MAPI (C++ or Delphi only) or Redemption, in particular its RDO family of objects - Redemption.RDOSession is very similar to MAPI.Session in CDO 1.21.