Public Function LinkEmail()
'Description: determin the active mail, save it to server as msg-file
'and return the location to the caller
On Error GoTo Action_Err
'Variables
Dim myEmail As Inspector
Dim SaveEmail As Object
Dim strName As String
'Search for open mail
Set myEmail = Outlook.Application.ActiveInspector
If Not TypeName(myEmail) = "Nothing" Then
Set SaveEmail = myEmail.CurrentItem
SaveEmail.SaveAs "Enter path here (filename included) as string", olMSG
LinkEmail = strName
Else
MsgBox "No open mail has been detected" & Chr(13) & _
"If you wish to add an email, you will have " & Chr(13) & _
"to open the mail.", vbOKOnly, "No open mail detected"
End If
Action_Exit:
Exit Function
Action_Err:
'Error handling
MsgBox Err.description
GoTo Action_Exit
End Function