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

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.Recipients.Add(ls_sendto)
                  oleSafeMailItem.Recipients.ResolveAll
                  oleSafeMailItem.Subject = ls_subject
                  oleSafeMailItem.Send

            Else
                  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!, &
                           Ok!)
            End If
      Else
            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!, &
                     Ok!)
      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.
BooBoo2004Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sajuksCommented:
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
        connecttonewobject(outlook.application.11)
. I tested your code its working. Did you try this in some other machine ?
 

0
BooBoo2004Author Commented:
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.
0
diasroshanCommented:
hi,

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...


Cheers,
Rosh
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.