Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attempt to send mail from Excel results in warning message.

Status
Not open for further replies.

ssmgr

Technical User
Feb 2, 2003
40
AU
I am attempting to send an email from within Microsoft Office Excel 2003 via VBA. Operating system is XP Professional Desktop.

Dim OL As Outlook.Application
Dim Folder1 As Outlook.MAPIFolder
Dim olMailItem As Outlook.MailItem
Dim ToContact As Outlook.Recipient

Set OL = New Outlook.Application
Set Folder1 = OL.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set olMailItem = Folder1.Items.Add

With olMailItem
.Subject = "subject text"
Set ToContact = .Recipients.Add "joe.bloggs@somewhere.com.au")

.Body = "message text"
.Save
.Send

End With

Set ToContact = Nothing
Set olMailItem = Nothing
Set Folder1 = Nothing
Set OL = Nothing


Each time I use the .Send command a Microsoft Office Outlook window appears advising that
"A program is trying to automatically send e-mail on your behalf. Do you want to allow this? If this is unexpected, it may be a virus and you should choose No". Is there any way to stop this window appearing, because I don't want to give the user the option of not sending an email to advise of their activity. Any advice would be appreciated.
 
Thanks for the information. I had recently checked the FAQs and didn't see these posts. The third option actually works well so I'll give it a try.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top