A
Austin Bike
I am trying to put some database fields into an outlook automation to
generate an email from the database form.
It works if I just leave the body as one field, but as soon as I try
to add an "&" and multiple fields it fails with the comment that it
can't understand character "|"
Private Sub sendmail()
'declare variables for the email
Dim sbjt As String
Dim OL As Outlook.Application
Dim OLNS As Outlook.NameSpace
Dim MailFolder As Outlook.MAPIFolder
Dim MyMail As Outlook.MailItem
Dim MailTo
Dim empmessage As String
Dim noteaddress As String
noteaddress = "(e-mail address removed)"
sbjt = "Large Opportunity Request Form"
'PREPARE MESSAGE
empmessage = "This is a test message."
Set OL = New Outlook.Application
Set OLNS = OL.GetNamespace("MAPI")
Set MailFolder = OLNS.GetDefaultFolder(olFolderInbox)
Set MyMail = MailFolder.Items.Add
Set MailTo = OLNS.CreateRecipient(noteaddress)
'prepare the message
With MyMail
.To = "(e-mail address removed)"
.Subject = "Large Opportunity Request Form"
.Body = "An opportunity for " & [CUSTOMER] & "entered on" &
[entry_date] & " by" & [deal_owner] & "requires specially priced SKUs.
"
.save
.Send
End With
Set OL = Nothing
Set OLNS = Nothing
Set MailFolder = Nothing
Set MyMail = Nothing
MsgBox "Email notification sent.", vbInformation, "Notification"
End Sub
What is the right syntax for ".body" to allow me to put multiple
fields and text in the message? I tried putting the name of the
database with the name of the field (i.e. [pipeline]![customer] ) and
that doesn't help.
Thanks in advance.
generate an email from the database form.
It works if I just leave the body as one field, but as soon as I try
to add an "&" and multiple fields it fails with the comment that it
can't understand character "|"
Private Sub sendmail()
'declare variables for the email
Dim sbjt As String
Dim OL As Outlook.Application
Dim OLNS As Outlook.NameSpace
Dim MailFolder As Outlook.MAPIFolder
Dim MyMail As Outlook.MailItem
Dim MailTo
Dim empmessage As String
Dim noteaddress As String
noteaddress = "(e-mail address removed)"
sbjt = "Large Opportunity Request Form"
'PREPARE MESSAGE
empmessage = "This is a test message."
Set OL = New Outlook.Application
Set OLNS = OL.GetNamespace("MAPI")
Set MailFolder = OLNS.GetDefaultFolder(olFolderInbox)
Set MyMail = MailFolder.Items.Add
Set MailTo = OLNS.CreateRecipient(noteaddress)
'prepare the message
With MyMail
.To = "(e-mail address removed)"
.Subject = "Large Opportunity Request Form"
.Body = "An opportunity for " & [CUSTOMER] & "entered on" &
[entry_date] & " by" & [deal_owner] & "requires specially priced SKUs.
"
.save
.Send
End With
Set OL = Nothing
Set OLNS = Nothing
Set MailFolder = Nothing
Set MyMail = Nothing
MsgBox "Email notification sent.", vbInformation, "Notification"
End Sub
What is the right syntax for ".body" to allow me to put multiple
fields and text in the message? I tried putting the name of the
database with the name of the field (i.e. [pipeline]![customer] ) and
that doesn't help.
Thanks in advance.