sending email to outlook from vb6 program - warning messages in outlook
I am developing a vb6 application that uses outlook to send an email from within the vb6 program. The message is sent but only after outlook displays 2 warning messages about "A program is trying to access e-mail addresses you have stored in outlook" and "A program is trying to automatically send email on your behalf".
I do not want the error messages to pop up. See the attached file for screen snapshot of the warning messages. Also, I have checked the Microsoft Outlook 11.0 Object Library.
Thanks for any help on how I can eliminate the messages.
Morrisbo
Private Sub mnuEmailTest_Click()Dim oApp As Object 'OutlookDim oNewMail As ObjectSet oApp = New Outlook.ApplicationSet oNewMail = oApp.CreateItem(olMailItem)With oNewMail .Display .Recipients.Add "mb@testwebsite.com" .Subject = "Subject here" .Body = "Text here" .Attachments.Add "c:\mypdf.pdf" .SendEnd WithSet oNewMail = NothingSet oApp = NothingEnd Sub
I was able to solve the problem by just changing the .Send item to .Display.
This change causes outlook to pop up with the email information filled in, ready to send.
I have included the code below.
Really appreciate your help with links to various documentation.
Had to look more on the internet to find the code snippet using outlook.Application.
Morrisbo
Sub SendEmail() Dim olApp As Outlook.Application Dim olMail As MailItem Dim CurrFile As String Set olApp = New Outlook.Application Set olMail = olApp.CreateItem(olMailItem) With olMail .To = "name@domain.net" .CC = "name2@domain2.com" .Subject = "These two files" .Body = "Body of email goes here .Attachments.Add "c:\My Documents\book.doc" .Display '.Send ---> just changed .Send to .Display End With Set olMail = Nothing Set olApp = NothingEnd Sub
http://support.microsoft.com/kb/263084