do not display the email

yoavchen

Registered User.
Local time
Today, 14:08
Joined
Jan 31, 2005
Messages
53
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
 
Where? in what field?
 
This is just a guess, but I would try:

Code:
oMailItem.Visible = False

and put it right after

Code:
Set oMailItem = oOutlook.CreateItem(olMailItem)

Like I said, that's only a guess because I haven't done a whole lot with Outlook objects.
 

Users who are viewing this thread

Back
Top Bottom