Hi Carl,
You will need to qualify which interface the Send method should call. Change your code to the following:
Imports System
Imports System.Reflection
Imports System.Web.Mail
Imports System.Windows.Forms
Module ModEmail
Public golapp As Outlook.Application
Public golNameSpace As Outlook.NameSpace
Sub SendTheMail()
Dim oApp As Outlook.Application
Dim omail As Outlook._MailItem
oApp = New Outlook.Application()
omail = oApp.CType(CreateItem(Outlook.OlItemType.olMailItem),Outlook._MailItem)
omail.To = "Someone@abc.com"
omail.Subject="Trying to send email"
omail.Body="This is the body"
omail.Send()
omail = Nothing
oApp = Nothing
End Sub
End Module
>I've been trying to send email messages in VB.Net with no luck. I have seen examples of doing so, but can't get them to work.
>
>My computer is running XP Pro.
>
>The code is ...
>
>Imports System
>Imports System.Reflection
>Imports System.Web.Mail
>Imports System.Windows.Forms
>
>Module ModEmail
> Public golapp As Outlook.Application
> Public golNameSpace As Outlook.NameSpace
>
> Sub SendTheMail()
>
> Dim oApp As Outlook.Application
> Dim omail As Outlook.MailItem
>
> oApp = New Outlook.Application()
> omail = oApp.CreateItem(Outlook.OlItemType.olMailItem)
> omail.To = "
Someone@abc.com"
> omail.Subject="Trying to send email"
> omail.Body="This is the body"
> omail.Send()
> omail = Nothing
> oApp = Nothing
> End Sub
>End Module
>
>I get the squiggly line under omail.send() with the following error buring the build;
>
>'Send' is ambiguous across the inherited interfaces 'Outlook._MailItem' and 'Outlook.ItemEvents_10_Event'.
>
>Thanks for any help,
>Carl
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi