why in the 'inbox' folder????

R

rocco

Hello,
i have the following code that I use to send an email from an access
database through VBA.
What happens is that the method .SAVE seems to save the email message in the
inbox folder (which is the default one, I assume).
I want to have the message in the outbox folder or at least in the draft one.
How can I manage this?

thanks!!
here is the code:

Private Sub INVIO_Click()

Dim objol As Outlook.Application
Set objol = New Outlook.Application
Dim messaggio As Object
With objol
Set messaggio = .CreateItem(olMailItem)
End With
With messaggio
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "SELECT TOP 1 nameback,backupdate FROM u_users ORDER BY
u_users.backupdate DESC", CurrentProject.Connection, adOpenStatic,
adLockReadOnly
.Attachments.Add CurrentProject.Path & "\archivio_backup\" & rst.Fields(0)
rst.CLOSE
Set rst = Nothing
.Attachments.Add CurrentProject.Path & "\backup.zip"
.To = "(e-mail address removed)"
.Subject = "Invio delle tabelle del database da: " & CurrentUser() & "
alle " & Now()
messaggio.Save
End With

Exit Sub
 
D

Dmitry Streblechenko

After the line

Set objol = New Outlook.Application

add

set NS = objol.GetNamespace("MAPI")
NS.Logon

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
D

Dmitry Streblechenko

Outlook delays logging to MAPI until the very last moment. The fact that a
message is created in the Inbox folder rather than Drafts is an indication
of that.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
R

rocco

Uh?!
I barely understand what you said...but It works that's more then enough!!!

Thank you
 

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