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