i have this code. i want to send the mail and NOT display it, i put only the send and still it send it okay, but also display it. please advice.
Function DoMail()
Dim oOutlook As Outlook.Application
Dim oNameSpace As Outlook.NameSpace
Dim oMailItem As Outlook.MailItem
Set oOutlook = New Outlook.Application
Set oNameSpace = oOutlook.GetNamespace("MAPI")
Set oMailItem = oOutlook.CreateItem(olMailItem)
With oMailItem
.Subject = "Test Mail b subject"
.To = "mail@mail.com""
.HTMLBody = "html string" 'use this if you want to send html email
.Body = "test for birthday" 'use this if you want to send plain text email
.Send 'send it
End With
Set oMailItem = Nothing
Set oNameSpace = Nothing
Set oOutlook = Nothing
End Function
Function DoMail()
Dim oOutlook As Outlook.Application
Dim oNameSpace As Outlook.NameSpace
Dim oMailItem As Outlook.MailItem
Set oOutlook = New Outlook.Application
Set oNameSpace = oOutlook.GetNamespace("MAPI")
Set oMailItem = oOutlook.CreateItem(olMailItem)
With oMailItem
.Subject = "Test Mail b subject"
.To = "mail@mail.com""
.HTMLBody = "html string" 'use this if you want to send html email
.Body = "test for birthday" 'use this if you want to send plain text email
.Send 'send it
End With
Set oMailItem = Nothing
Set oNameSpace = Nothing
Set oOutlook = Nothing
End Function