Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-06-2021, 09:33 PM
gmayor's Avatar
gmayor gmayor is offline Custom Fields in Outlook Emails Windows 10 Custom Fields in Outlook Emails Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default


The short answer is 'no'.
You have no control over your clients' e-mail applications. You have no control over the incoming e-mail formats - with plain text having no compatibility with fields. If you add material to messages, you damage their evidential value in the event of a future legal action.
In theory you can add to an e-mail message, either incoming or outgoing using a macro (or in the case of incoming a script attached to a rule), but I would avoid fields. At its simplest it would be as follows, but you could replace the reference input box with a lookup to the Access table.
Open a new (or existing) message and run the Test macro.

Code:
Sub Test()
Dim olMsg As MailItem
On Error Resume Next
    Select Case Outlook.Application.ActiveWindow.Class
        Case olInspector
            Set olMsg = ActiveInspector.currentItem
        Case olExplorer
            Set olMsg = Application.ActiveExplorer.Selection.Item(1)
    End Select
    AddData olMsg
    Set olMsg = Nothing
End Sub

Sub AddData(olItem As MailItem)
'Graham Mayor - https://www.gmayor.com - Last updated - 07 Jul 2021
Dim olInsp As Outlook.Inspector
Dim wdDoc As Object
Dim oRng As Object
Dim sCase As String, sRef As String

    sCase = InputBox("Enter the case number")
    sRef = InputBox("Enter the reference number")

    With olItem
        .BodyFormat = olFormatHTML
        Set olInsp = .GetInspector
        Set wdDoc = olInsp.WordEditor
        Set oRng = wdDoc.Range
        oRng.collapse 1
        oRng.Text = "++++++++++++++++ Admin use only ++++++++++++++++++++" & vbCr & vbCr & _
                    "Case: " & sCase & vbCr & "Reference: " & sRef & vbCr & vbCr & _
                    "++++++++++++++++++++++++++++++++++++++++++++++++++" & vbCr & vbCr
        oRng.collapse 0
        oRng.Select
    End With
lbl_Exit:
    Set olInsp = Nothing
    Set wdDoc = Nothing
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Fields in Outlook Emails Custom fields formula fragono Project 2 03-02-2016 11:03 AM
Custom Fields in Outlook Emails Custom fields used in the Compare Function OTPM Project 3 03-02-2015 06:43 AM
Contact custom fields not showing Hmcrunchy Outlook 0 08-28-2013 03:54 AM
Custom Fields in Outlook Emails Tasks Import ( Custom fields) VidyaR Outlook 1 02-13-2013 07:01 AM
Stumped on Grouping with Custom Fields... ViperMan Project 1 06-22-2011 01:31 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:42 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft