Hi
Im using sendmessage as a public function to send an email, I'd like to let the user set the importance of the message.
Iv tried changing the code where it states the email importance to:
.Importance = ([Forms]![frmTRupdate]![text101])
Text101 is unbound combo on form TRupdate with olimportanceLow;olimportanceNormal;olImportanceHigh as the value list.
But this is not working.
Any ideas?
Heres the code in full
Im using sendmessage as a public function to send an email, I'd like to let the user set the importance of the message.
Iv tried changing the code where it states the email importance to:
.Importance = ([Forms]![frmTRupdate]![text101])
Text101 is unbound combo on form TRupdate with olimportanceLow;olimportanceNormal;olImportanceHigh as the value list.
But this is not working.
Any ideas?
Heres the code in full
Code:
Public Function ASiSendMessage() '(Optional AttachmentPath As String)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim nl As String
nl = vbNewLine & vbNewLine
On Error GoTo ErrorMsgs
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message. Substitute
' your names here.
'Set objOutlookRecip = ([Forms!form12.Combo11])
Set objOutlookRecip = .Recipients.Add([Forms]![frmTRUpdate]![AssignedEngineer].Column(0))
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
' Set the Subject, Body, and Importance of the message.
.Subject = "A new Technical Request, number " & ([Forms]![frmTRUpdate]![TR number]) & " has been assigned to you"
.Body = "Customer: " & ([Forms]![frmTRUpdate]![CustomerType]) & nl & _
"The subject of the TR is: " & ([Forms]![frmTRUpdate]![Subject])
.Importance = [Forms]![frmTRUpdate]![Text109]
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing
ErrorMsgs:
If Err.Number = "287" Then
MsgBox "You clicked No to the Outlook security warning. Rerun the procedure and click Yes to access e-mail addresses to send your message. For more information, see the document at [URL]http://www.microsoft.com/office/previous/outlook/downloads/security.asp[/URL]. "
Else
MsgBox "E-mail sent"
End If
End Function