![]() |
|
#1
|
||||
|
||||
![]() 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 |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
fragono | Project | 2 | 03-02-2016 11:03 AM |
![]() |
OTPM | Project | 3 | 03-02-2015 06:43 AM |
Contact custom fields not showing | Hmcrunchy | Outlook | 0 | 08-28-2013 03:54 AM |
![]() |
VidyaR | Outlook | 1 | 02-13-2013 07:01 AM |
Stumped on Grouping with Custom Fields... | ViperMan | Project | 1 | 06-22-2011 01:31 AM |