ERROR: ActiveX component can't create object (MAPI.Session) on Vista

Make sure you have installed CDO 1.21 which comes separately and no longer ships with Outlook 2007

Download it here : https://www.microsoft.com/downloads/details.aspx?FamilyID=2714320d-c997-4de1-986f-24f081725d36&DisplayLang=en

if you are running it on Exchange 2007 server then you need Exchange Server version of it, which can be found here : https://www.microsoft.com/downloads/details.aspx?familyid=E17E7F31-079A-43A9-BFF2-0A110307611E&displaylang=en

Still getting the same error??? Are you running 64bit version of Vista and you application is 64bit... stop there!

CDO 1.21 is 32bit ONLY it will not run under 64 bit. So make sure you run your application under 32bit

If this is a VBScript or JavaScript code running under cmd.exe or Internet Explorer, make sure you have host application running as 32bit

for cscript or wscript version of 32bit launch them from C:\windows\syswow64\cscript.exe (or wscript.exe)

32bit version of IE can be found here - c:\Program Files (x86)\Internet Explorer\iexplore.exe

 Just one more thing to check if you are running in IE7 and above... You cant
create objects in "Protected Mode". Turn it off before you run your script.

And lowering security settings is bad, anything  page could run code if you allow it. This means your machines could be taken over by code from any malicious web site.  This should be considered before turning it off against.   You “May” be able to put it into a signed active control and then have IE only allow signed active X controls. However, you should consider alternatives ways to run your code. Why cant you run outside of IE or have Web code do it in other way?