1
votes

I have tried to google around on how to access field in outlook messages (not form fields) from VBA but to no avail.

An illustration of the field: http://i.stack.imgur.com/hCfOV.png

Can any one point me to the right direction to search, or can provide me with snippet of code to get started?

I have read Word 2010 can Field added via QuickParts be given an ID and later referenced in document.Fields collection and learnt that it can be accessed from the Fields object.

Example in Word:

For Each fld In ActiveDocument.Fields
    If InStr("CARMODEL", fld.Code) <> 0 Then
        ''this is the carmodel field
    End If
Next

I have tried to use

   Dim CurrentMessage As MailItem
   Set CurrentMessage = ActiveInspector.CurrentItem

to set the active mail item but I couldn't access the Field list.

Thank you!

Sincerely, James

1

1 Answers

0
votes

Is the message being displayed? Inspector.WordEditor will return the Word Document object.