I have been surfing through all the topics on this subject and can't seem to find the right information. I found a post that demonstrates how to create an email from Access that automatically sends.
This work great for me. The problem I have is that I want to copy and paste information from a word doc into the body fo the email and have it send.
Here is the code I am using below:
Public Sub SendCAReport()
Dim objAttachment As Object
Dim objMailDb As Object
Dim objMailDocument As Object
Dim objEmbedObject As Object
Dim objNotesSession As Object
Dim oDoc As Word.Application
Dim fSaveMailToTheSentFolder As Boolean
fSaveMailToTheSentFolder = True
Dim strMailDbName As String
Dim strMailTitle As String
Dim strLotusNotesUserID As String
Dim strMessage As t
On Error Resume Next
'copy info from Word
Set oDoc = GetObject("C:\CASummary.doc")
oDoc.Documents.Open ("C:\CASummary.doc")
strMessage = oDoc.ActiveDocument.Content
'Start objNotesSession in Lotus Notes
Set objNotesSession = CreateObject("Notes.NotesSession")
'Open the mail database in Lotus Notes
Set objMailDb = objNotesSession.GETDATABASE("", strMailDbName)
objMailDb.OPENMAIL
'Set up the new mail document
strMailTitle = "CA Turn-In Requests"
strLotusNotesUserID = "brenenger@capitalcabinet.com"
Set objMailDocument = objMailDb.CREATEDOCUMENT
objMailDocument.Form = "Memo"
objMailDocument.sendto = strLotusNotesUserID
objMailDocument.Subject = strMailTitle
objMailDocument.Body = strMessage
objMailDocument.SAVEMESSAGEONSEND = fSaveMailToTheSentFolder
'Send the document
objMailDocument.SEND 0, strLotusNotesUserID
oDoc.Documents.Close ("C:\CASummary.doc")
'Clean Up
Set objMailDb = Nothing
Set objMailDocument = Nothing
Set objAttachment = Nothing
Set objNotesSession = Nothing
Set objEmbedObject = Nothing
End Sub
It just sends a blank email.
Any ideas would be GREATLY appreciated.
This work great for me. The problem I have is that I want to copy and paste information from a word doc into the body fo the email and have it send.
Here is the code I am using below:
Public Sub SendCAReport()
Dim objAttachment As Object
Dim objMailDb As Object
Dim objMailDocument As Object
Dim objEmbedObject As Object
Dim objNotesSession As Object
Dim oDoc As Word.Application
Dim fSaveMailToTheSentFolder As Boolean
fSaveMailToTheSentFolder = True
Dim strMailDbName As String
Dim strMailTitle As String
Dim strLotusNotesUserID As String
Dim strMessage As t
On Error Resume Next
'copy info from Word
Set oDoc = GetObject("C:\CASummary.doc")
oDoc.Documents.Open ("C:\CASummary.doc")
strMessage = oDoc.ActiveDocument.Content
'Start objNotesSession in Lotus Notes
Set objNotesSession = CreateObject("Notes.NotesSession")
'Open the mail database in Lotus Notes
Set objMailDb = objNotesSession.GETDATABASE("", strMailDbName)
objMailDb.OPENMAIL
'Set up the new mail document
strMailTitle = "CA Turn-In Requests"
strLotusNotesUserID = "brenenger@capitalcabinet.com"
Set objMailDocument = objMailDb.CREATEDOCUMENT
objMailDocument.Form = "Memo"
objMailDocument.sendto = strLotusNotesUserID
objMailDocument.Subject = strMailTitle
objMailDocument.Body = strMessage
objMailDocument.SAVEMESSAGEONSEND = fSaveMailToTheSentFolder
'Send the document
objMailDocument.SEND 0, strLotusNotesUserID
oDoc.Documents.Close ("C:\CASummary.doc")
'Clean Up
Set objMailDb = Nothing
Set objMailDocument = Nothing
Set objAttachment = Nothing
Set objNotesSession = Nothing
Set objEmbedObject = Nothing
End Sub
It just sends a blank email.
Any ideas would be GREATLY appreciated.