A program is trying to send mail using Item.Send

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to send a export table with a macro, but all time appear this message:
A program is trying to send mail using Item.Send

i make this macro:
Sub a()
Dim oOutlook As Object
Dim oMailItem As Object
Dim oRecipient As Object
Dim oNameSpace As Object
Dim sAttachment As String


sAttachment = "C:\autoexec.bat"

Set oOutlook = CreateObject("Outlook.Application")
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
oNameSpace.Logon , , True
Set oMailItem = oOutlook.CreateItem(0)
oMailItem.to = "(e-mail address removed)"
oMailItem.subject = "Test"
oMailItem.Body = "Body Test"
'oMailItem.Display
oMailItem.Save
oMailItem.SEND
oNameSpace.LOGOFF

End Sub

but the warning pop up every time.

Some one can help me ?
 
That warning is there for a reason. Someone could be using your machine to
send mail. If you want to hide the notification you'd have to use
'redemption'. You need to set a reference to a library for outlook to not
show the notification.
For detailed information post your question in the outlook.vba group.

hth
 
Back
Top