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