Good Morning All;
I have the following code on a button in my database; which works fine and I'm happy with.
--------------------------------------------------------------
On Error GoTo Hell
Dim NameSpace As Object
Dim EmailSend As MailItem
Dim EmailApp As Object
Dim strUser As String
strUser = "Enter E Mail Address"
Set EmailApp = CreateObject("Outlook.Application") 'using the outlook object
Set NameSpace = EmailApp.GetNamespace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)
EmailSend.Subject = "Request"
EmailSend.Body = "Test E Mail "
'EmailSend.Attachments.Add ("source/path")
'EmailSend.ReadReceiptRequested = True 'receipt request
EmailSend.Recipients.Add (strUser) 'send to?
'EmailSend.Save 'you MUSt save emails with attachments
EmailSend.Display 'display the email
Heaven:
Set EmailSend = Nothing
Exit Sub
Hell:
MsgBox Err.Description, vbCritical, "Error #: " & Err.Number
Resume Heaven
End Sub
--------------------------------------------------------------
But... what I was hoping to do; was perhaps use the ‘me.field name’ code to reference 2 dates from my form; and send them in to the ‘EmailSend.Body =’ area of my e mail as a concatenated text string.
Is this possible? And if so; how would I write the code for this?
Your help as always is very much appricaiated.
Kind Regards
Tor Fey
I have the following code on a button in my database; which works fine and I'm happy with.
--------------------------------------------------------------
On Error GoTo Hell
Dim NameSpace As Object
Dim EmailSend As MailItem
Dim EmailApp As Object
Dim strUser As String
strUser = "Enter E Mail Address"
Set EmailApp = CreateObject("Outlook.Application") 'using the outlook object
Set NameSpace = EmailApp.GetNamespace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)
EmailSend.Subject = "Request"
EmailSend.Body = "Test E Mail "
'EmailSend.Attachments.Add ("source/path")
'EmailSend.ReadReceiptRequested = True 'receipt request
EmailSend.Recipients.Add (strUser) 'send to?
'EmailSend.Save 'you MUSt save emails with attachments
EmailSend.Display 'display the email
Heaven:
Set EmailSend = Nothing
Exit Sub
Hell:
MsgBox Err.Description, vbCritical, "Error #: " & Err.Number
Resume Heaven
End Sub
--------------------------------------------------------------
But... what I was hoping to do; was perhaps use the ‘me.field name’ code to reference 2 dates from my form; and send them in to the ‘EmailSend.Body =’ area of my e mail as a concatenated text string.
Is this possible? And if so; how would I write the code for this?
Your help as always is very much appricaiated.
Kind Regards
Tor Fey