'Send' is ambiguous across the inherited interfaces 'Outlook._MailItem' and 'Outlook.ItemEvents_10_Event'.

I am trying to send a message through Outlook 2003 using vb.net 2002.  But I get this error message:
'Send' is ambiguous across the inherited interfaces 'Outlook._MailItem' and 'Outlook.ItemEvents_10_Event'.

I checked this link: http://support.microsoft.com/?kbid=315981

I tried applying both solutions, but could not get either to work.  Here is my code:

Sub SendMessage(ByVal s_AttachmentPath As String, ByVal S_Address As String, ByVal S_Body As String, ByVal S_Subject As String)
        'The purpose of this function is to send an attachment e-mail

        'Declare the outlook variables
        Dim v_Outlook As New Outlook.ApplicationClass()
        Dim v_Message As Outlook.MailItem
        Dim v_Recipient As Outlook.Recipient
        Dim v_Attachment As Outlook.Attachment

        Dim strTempAddress As String    'temporary storage for e-mail address
        Dim strAddress As String        'storage for single e-mail addresses
        Dim intPosition As String       'stores the position of the ; to split e-mail addresses

        Dim strTempAttach As String    'temporary storage for attachment paths
        Dim strAttachment As String    'storage for single attachment path

        'Start the outlook session
        v_Outlook = New Outlook.ApplicationClass()

        'Create the Message
        v_Message = v_Outlook.CreateItem(Outlook.OlItemType.olMailItem)

        With v_Message


            'Stores all of the attachment paths that was passed in
            strTempAttach = s_AttachmentPath

            intPosition = 1

            'While loop to go through the e-mail address to determine if there are multiple addresses
            While intPosition <> 0
                intPosition = InStr(intPosition + 1, strTempAttach, ";", vbBinaryCompare)
                If intPosition <> 0 Then
                    strAttachment = Left(strTempAttach, intPosition - 1)
                    strTempAttach = Right(strTempAttach, Len(strTempAttach) - (intPosition + 1))
                Else
                    strAttachment = strTempAttach
                End If

                'Add attachment
                If Not IsNothing(strAddress) Then
                    v_Attachment = .Attachments.Add(strAttachment)
                End If
            End While

            'Stores all of the e-mail addresses that was passed in
            strTempAddress = S_Address

            intPosition = 1

            'While loop to go through the e-mail address to determine if there are multiple addresses
            While intPosition <> 0
                intPosition = InStr(intPosition + 1, strTempAddress, ";", vbBinaryCompare)
                If intPosition <> 0 Then
                    strAddress = Left(strTempAddress, intPosition - 1)
                    strTempAddress = Right(strTempAddress, Len(strTempAddress) - (intPosition + 1))
                Else
                    strAddress = strTempAddress
                End If
                'Adds each recipient
                v_Recipient = .Recipients.Add(strAddress)
            End While

            v_Recipient.Type = Outlook.OlMailRecipientType.olTo

            'Set the subject line
            .Subject = S_Subject

            'Set the body text
            .Body = S_Body

        End With

        'Send the message
        CType(v_Outlook, Outlook.MailItem).Send()

        'clear the variables
        v_Outlook = Nothing
        v_Message = Nothing
        v_Recipient = Nothing


    End Sub

Can someone tell me what I am doing wrong?

Thanks,
      Jonathan
jdonagheAsked:
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.

William ElliottSr Tech GuruCommented:
i think you may just need to remove the  () from the send
0
smitchamCommented:
In the code you have posted you are casting the outlook object and not the message object.  Try

CType(v_Message,Outlook.MailItem).Send
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
jdonagheAuthor Commented:
You are partially right.  I made a mistake when I was coding.  I put Outlook.MailItem not Outlook_MailItem.

CType(v_Message,Outlook._MailItem).Send

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