error 429 Cannot create Outlook object

Hi,

This code work perfect, but now for some reason i get an error 429, Cannot create outlook object. I try to find an answer, but i never found. It's like a dll or registry problem, any Idea?
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.GetOutlook()
        Me.SendMessage()

    End Sub
    ' Declare module level variables
    Dim mOutlookApp As Microsoft.Office.Interop.Outlook.Application
    Dim mNameSpace As Microsoft.Office.Interop.Outlook.NameSpace
    Dim mFolder As Microsoft.Office.Interop.Outlook.MAPIFolder
    Dim mItem As Microsoft.Office.Interop.Outlook.MailItem
    Dim fSuccess As Boolean

    ' Module contains only 2 methods:  
    '    1) GetOutlook() 
    '    2) SendMessage() 
    ''
    Public Function GetOutlook() As Boolean
        ' The GetOutlook() function sets the Outlook Application 
        ' and Namespase objects and opens MS Outlook
        On Error Resume Next

        ' Assume success
        fSuccess = True

        mOutlookApp = GetObject("", "Outlook.aplication")

        ' If Outlook is NOT Open, then there will be an error. 
        ' Attempt to open Outlook

        If Err.Number > 0 Then
            Err.Clear()
            mOutlookApp = CreateObject("Outlook.aplication")

            If Err.Number > 0 Then
                MsgBox(Err.Number)
                MsgBox("Could not create Outlook object", vbCritical)
                fSuccess = False
                Exit Function
            End If
        End If

        ' If we've made it this far, we have an Outlook App Object 
        ' Now, set the NameSpace object to MAPI Namespace
        mNameSpace = mOutlookApp.GetNamespace("MAPI")

        If Err.Number > 0 Then
            MsgBox("Could not create NameSpace object", vbCritical)
            fSuccess = False
            Exit Function
        End If

        ' Return the Success Flag as the value of GetOutlook()
        GetOutlook = fSuccess

Open in new window

LVL 1
joyacv2Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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

tbsgadiCommented:
Which version of Outlook?
0
joyacv2Author Commented:
hi,

Outlook 2007
0
tbsgadiCommented:
Did it stop working when you upgraded to 2007 or have you had it working with 2007?

0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

joyacv2Author Commented:
Hi,

The problems occurs suddenly. This code works perfect, maybe i change something during adapting with my program. But I wrote the original code again and the problem appears. I really think that something happens in the registry during the modification. Any idea?
0
joyacv2Author Commented:
Hi,

One of the changed line was the Outlook.aplication, by error. But i correct that. Maybe here is the problem. This cause something crazy when try to run the code. After that the code, sends this 429 error.
0
tbsgadiCommented:
Have a look at the following:

http://support.microsoft.com/kb/828550

Gary
0
joyacv2Author Commented:
Hi,

I check this site and did step by step and the problem continues.
0
nffvrxqgrcfqvvcCommented:
<< mOutlookApp = GetObject("", "Outlook.aplication")>>
When you say you corrected this did you correctly spell it because your example only has one (p) in the word application.
Can you remove the On Error Resume next call and replace it with Try Catch instead.
mOutlookApp = GetObject("", "Outlook.aplication")
Try using:

Imports System.Runtime.InteropServices

Try
mOutlookApp = Marshal.GetActiveObject("Outlook.Application")
Catch ex As Exception
console.writeline(ex.message)
End Try

or

mOutlookApp = GetObject(, "Outlook.Application")

 
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
David LeeCommented:
The word "application" is misspelled as "aplication" on lines 25 and 32.  Correct the spelling and the code should work.
0
joyacv2Author Commented:
Thank You! This solve my problem!
0
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
Visual Basic.NET

From novice to tech pro — start learning today.