Control contents of email fields in MS word 2016

I want to send the body of a word document as an email, but I want the user to be able to use the address book to select which recipients to send it to from MS Word 2016. When the user selects emails to send to, I want them to ONLY be able to put in the BCC field.

Where I am stuck is monitoring the to/from/CC/BCC fields for changes, and then moving those changes to BCC. The documentation seems to indicate the usage of Inspectors, but nothing specific about accessing the contents of these fields.

I had two approaches to this, one being to open a new Outlook mail item, load the contents of the word file to it, and then try to monitor the fields that way.

The other way was to send it directly from word using the Quick Access Toolbar option "Send to Mail Recipient" to open an email message and then send it that way. But I don't know if that is really an option based on what I was reading and if those fields are accessible via VBA.

Code example of what I have so far below:


Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

On Error Resume Next

'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
    'Outlook wasn't running, start it from code
    Set oOutlookApp = CreateObject("Outlook.Application")
    bStarted = True
End If

'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem
    'Set the recipient for the new email
   .To = "[email protected]"
    'Set the recipient for a copy
    .CC = "[email protected]"
    'Set the subject
    .Subject = "New subject"
    'The content of the document is used as the body for the email
    .Body = ActiveDocument.Content
    .Send
End With

If bStarted Then
    'If we started Outlook from code, then close it
    oOutlookApp.Quit
End If

'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing

End Sub

It seems you are interested in the SelectNamesDialog object which displays the Select Names dialog box for the user to select entries from one or more address lists, and returns the selected entries in the collection object specified by the property SelectNamesDialog.Recipients.

The dialog box displayed by SelectNamesDialog.Display is similar to the Select Names dialog box in the Outlook user interface. It observes the size and position settings of the built-in Select Names dialog box. However, its default state does not show Message Recipients above the To, Cc, and Bcc edit boxes.

The following code sample shows how to create a mail item, allow the user to select recipients from the Exchange Global Address List in the Select Names dialog box, and if the user has selected recipients that can be completely resolved, then send the mail item.

Sub SelectRecipients() 
 Dim oMsg As MailItem 
 Set oMsg = Application.CreateItem(olMailItem) 
 Dim oDialog As SelectNamesDialog 
 Set oDialog = Application.Session.GetSelectNamesDialog 
 With oDialog 
 .InitialAddressList = _ 
 Application.Session.GetGlobalAddressList 
 .Recipients = oMsg.Recipients 
 If .Display Then 
 'Recipients Resolved 
 oMsg.Subject = "Hello" 
 oMsg.Send 
 End If 
 End With 
End Sub