Hey all, i'm trying to send an output email from my vb.net application. I checked out:
http://support.microsoft.com/?kbid=313803
I tried to test this but I get a 'Type 'Outlook.Application is not defined' error.
I tried adding the reference:Code:Public Sub sendEmail() ' Create an Outlook application. Dim oApp As Outlook.Application oApp = New Outlook.Application() ' Create a new MailItem. Dim oMsg As Outlook.MailItem oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem) oMsg.Subject = "Send Attachment Using OOM in Visual Basic .NET" oMsg.Body = "Hello World" & vbCr & vbCr ' TODO: Replace with a valid e-mail address. oMsg.To = "[email protected]" ' Add an attachment ' TODO: Replace with a valid attachment path. Dim sSource As String = "C:\Temp\Hello.txt" ' TODO: Replace with attachment name Dim sDisplayName As String = "Hello.txt" Dim sBodyLen As String = oMsg.Body.Length Dim oAttachs As Outlook.Attachments = oMsg.Attachments Dim oAttach As Outlook.Attachment oAttach = oAttachs.Add(sSource, , sBodyLen + 1, sDisplayName) ' Send oMsg.Send() ' Clean up oApp = Nothing oMsg = Nothing oAttach = Nothing oAttachs = Nothing End Sub
"Click the COM tab, locate Microsoft Outlook 11.0 Library or Microsoft Outlook 10.0 Object Library, and then click Select. "
But it does not exist. I added:
Microsoft Office 11.0 Object Library and
Microsoft Outlook 11.0 Object Library
I am currently using Outlook 2003.
Do I need to add a 'imports' or something?




Reply With Quote