oleobject.ConnectToNewObject("Outlook.Application") fails with a -3 return code

Posted on 2004-11-18
Last Modified: 2013-12-26
I am using the Outlook Redemption dll for my email application.  When I try to connect via the ConnectToNewObject("Outlook.Application"), I get a -3 return code.  I guess that this means that the object could not be created.  The code that I am using is:

      oleOutlook = create oleobject
      rc = oleOutlook.ConnectToNewObject("outlook.application")
      If rc = 0 Then
            oleNameSpace = oleOutlook.GetNameSpace("MAPI")
            oleNameSpace.Logon("", "", true, true)

            oleSafeMailItem = create oleobject
            rc = oleSafeMailItem.ConnectToNewObject("Redemption.SafeMailItem")

            If rc = 0 Then
                  oleTmp = create oleobject
                  oleTmp = oleOutlook.CreateItem(0)
                  oleSafeMailItem.Item = oleTmp
                  oleSafeMailItem.Subject = ls_subject

                  MessageBox("Mail Error", &
                           "Your email could not be sent.  Please contact IT.~r~n" + &
                           "The SafeMailItem  - ConnectToNewObject~r~n" + &
                           "failed with a return code of " + String(rc) + ".", &
                           StopSign!, &
            End If
            MessageBox("Mail Error", &
                     "Your email could not be sent.  Please contact IT.~r~n" + &
                     "The Outlook Application  - ConnectToNewObject~r~n" + &
                     "failed with a return code of " + String(rc) + ".", &
                     StopSign!, &
      End If

If I change the Outlook.Application with Word.Application, the connecttonewobject works fine.  I think that this may be a registry problem.  When I compare Outlook.Application to the Word.Application registry values, I do not see the key VersionIndependentProgID for Outlook.  I added it, but it still did not work.  I would like to get this fixed ASAP.

I am using PB10, Windows 2000, Outlook 2003 (Mail server is Exchange), and the latest Redemption dll.
Question by:BooBoo2004
    LVL 33

    Expert Comment

    what is the return code if you use outlook.application.11 instead of outlook.application
         rc = oleOutlook.ConnectToNewObject("outlook.application.11")

    you could've if
       if connecttonewobject(outlook.application) failure then
    . I tested your code its working. Did you try this in some other machine ?


    Author Comment

    I changed it to outlook.application.11 and still get the same error.  I have not tried it on another machine as I am the only developer here.
    LVL 18

    Accepted Solution


    ur code seems to be right... guess some error with the software not being compatible...

    my first guess would be some issues with redemption dll.

    what i would suggest is uninstall the redemption dll and try the code...

    let me know for more assistance...


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
    How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from ( Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now