Modifying code to send attachments Access 97

teabags

Registered User.
Local time
Today, 00:36
Joined
Jun 29, 2006
Messages
21
Hi I am using this code to email from code. I was just wondering if anyone could show me how to modify my code so I can add an attachement using a string variable to give a location of a file like "C:\text.txt"


Function SendLotusEmail()
On Error GoTo Ett_Trap
Dim notesdb As Object
Dim notesdoc As Object
Dim notesrtf As Object
Dim notessession As Object
Dim ToName As String
Dim CCName As String
Dim BCCName As String
Dim Subject As String
Dim BodyText As String
ToName = "tea@tea.com"

CCName = ""

BCCName = ""
Subject = "This is a test"

BodyText = "You are tea"

Set notessession = CreateObject("Notes.Notessession")

Set notesdb = notessession.getdatabase("", "")
Call notesdb.openmail

Set notesdoc = notesdb.createdocument

Call notesdoc.replaceitemvalue("Sendto", ToName)

Call notesdoc.replaceitemvalue("CopyTo", CCName)

Call notesdoc.replaceitemvalue("BlindCopyTo", BCCName)

Call notesdoc.replaceitemvalue("Subject", Subject)

Call notesdoc.replaceitemvalue("Body", BodyText)

Call notesdoc.Send(False)

Call notesdoc.Save(True, False)

Set notessession = Nothing

MsgBox "Email sent"

Ett_Trap_Exit:
Exit Function

Ett_Trap:
MsgBox Err.Description
Resume Ett_Trap_Exit
End Function
 

Users who are viewing this thread

Back
Top Bottom