I have a code:
+++++++++++++++++++++++++++++++++
Private Sub SendEmailToAssignedTo_Click()
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.TaskItem
Dim myDelegate As Outlook.Recipient
Dim strImp As String
On Local Error GoTo SendEmailToAssignedTo_Err
Me.Sendon = Now()
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olTaskItem)
myItem.Assign
Set myDelegate = myItem.Recipients.Add(Forms!issues.Form![Assigned To E-Mail])
myDelegate.Resolve
strImp = Forms!issues.Form.Priority
If myDelegate.Resolved Then
myItem.Subject = Forms!issues.Form.Title & " Item number - " & Me.Item_Number
myItem.DueDate = Forms!issues.Form.[Due Date]
myItem.StartDate = Forms!issues.Form.[Opened Date]
If strImp = "(1) high" Then
strImp = olImportanceHigh
End If
If strImp = "(2) normal" Then
strImp = olImportanceNormal
End If
If strImp = "(3) low" Then
strImp = olImportanceLow
End If
myItem.Importance = strImp
'myItem.BodyFormat = olFormatHTML
myItem.Body = Forms!issues.Form.Comment & vbCr & vbCr & "Please see attachements if present for detailed clarificaitons" & _
vbCr & Me.Attachment & _
vbCr & Me.Attachment4 & vbCr & vbCr & _
"Please, take appropriate actions, update mail-task assigned and Excel link below" & _
vbCr & Me.Attachment2
myItem.Display
SendEmailToAssignedTo_Err:
MsgBox ("Outlook is not running, Launch Outlook and try again")
Exit Sub
End If
End Sub
++++++++++++++++++++++++++++
and it works almost fine, except 2 things:
1. Everytime it gives the error message even if it sends out the task
2. when outputting the hyperlinks ( attachment2,attachment, attachment4 ) it shows the display name and at the beggining and at the end of the filepath it puts stupid pound signs. Now hyperlinks in task do not work as they are not recognized as hypelinks.
ex.
Please see attachements if present for detailed clarificaitons
My letter#\\TCOTENNTDFS1\SHARE\All TCO Groups\Agency Inspections\Action Tracker\LINKS\Citation\DES Citation of 3000608\Citation dated 30 Jun 08_R.pdf#
Inspection letter#\\TCOTENNTDFS1\SHARE\All TCO Groups\Agency Inspections\Action Tracker\LINKS\Citation\DES Citation of 3000608\Citation dated June 30 08.pdf#
+++++++++++++++++++++++++++++++++
Private Sub SendEmailToAssignedTo_Click()
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.TaskItem
Dim myDelegate As Outlook.Recipient
Dim strImp As String
On Local Error GoTo SendEmailToAssignedTo_Err
Me.Sendon = Now()
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olTaskItem)
myItem.Assign
Set myDelegate = myItem.Recipients.Add(Forms!issues.Form![Assigned To E-Mail])
myDelegate.Resolve
strImp = Forms!issues.Form.Priority
If myDelegate.Resolved Then
myItem.Subject = Forms!issues.Form.Title & " Item number - " & Me.Item_Number
myItem.DueDate = Forms!issues.Form.[Due Date]
myItem.StartDate = Forms!issues.Form.[Opened Date]
If strImp = "(1) high" Then
strImp = olImportanceHigh
End If
If strImp = "(2) normal" Then
strImp = olImportanceNormal
End If
If strImp = "(3) low" Then
strImp = olImportanceLow
End If
myItem.Importance = strImp
'myItem.BodyFormat = olFormatHTML
myItem.Body = Forms!issues.Form.Comment & vbCr & vbCr & "Please see attachements if present for detailed clarificaitons" & _
vbCr & Me.Attachment & _
vbCr & Me.Attachment4 & vbCr & vbCr & _
"Please, take appropriate actions, update mail-task assigned and Excel link below" & _
vbCr & Me.Attachment2
myItem.Display
SendEmailToAssignedTo_Err:
MsgBox ("Outlook is not running, Launch Outlook and try again")
Exit Sub
End If
End Sub
++++++++++++++++++++++++++++
and it works almost fine, except 2 things:
1. Everytime it gives the error message even if it sends out the task
2. when outputting the hyperlinks ( attachment2,attachment, attachment4 ) it shows the display name and at the beggining and at the end of the filepath it puts stupid pound signs. Now hyperlinks in task do not work as they are not recognized as hypelinks.
ex.
Please see attachements if present for detailed clarificaitons
My letter#\\TCOTENNTDFS1\SHARE\All TCO Groups\Agency Inspections\Action Tracker\LINKS\Citation\DES Citation of 3000608\Citation dated 30 Jun 08_R.pdf#
Inspection letter#\\TCOTENNTDFS1\SHARE\All TCO Groups\Agency Inspections\Action Tracker\LINKS\Citation\DES Citation of 3000608\Citation dated June 30 08.pdf#