We help IT Professionals succeed at work.

Upgrading VBA project from Excel 2003 to 2007

crussell96
crussell96 asked
on
722 Views
Last Modified: 2008-01-09
I have an excel vba project that does not work after upgrading from Excel 2003 to 2007.  The following code is the part giving me problems.  In it I click a button and Outlook is supposed to email a bunch of pdfs from the directory that I choose.  After upgrading to Office 2007 I get the following error message.  

Run-time error -2147024770 (8007007e):
Automation error
The specified module could not be found.

Here is the code that is giving me the problem, the error occurs on the middle line.
    Dim objSession As Object
    Set objSession = CreateObject("mapi.session")   run time error occurs here
    objSession.Logon profileName:="MS Exchange Settings"

I made sure I have a reference to the Microsoft Office 12.0 Object Library. Any help would be appreciated.  
Comment
Watch Question

Try:

    Dim ol As Outlook.Application
    Dim ns As Namespace

    Set ol = New Outlook.Application
    Set ns = ol.GetNamespace("MAPI")

Commented:
You probably have an incorrect reference in your VBA code.

Go into VBA and click on Tools/References.  Any Invalid references are listed at the top with MISSING indicated.  Outlook is a specific pain switching between versions...

Author

Commented:
no missing references.
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.