A program is trying to send mail using Item.Send

H

he.ll.cat

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 ?
 
M

Maurice

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top