Refreshing outlook mailitem.display after further applying modifications

528 Views Asked by At

Usually modifications to a mailitem is performed prior to display. However, special circumstances require a refresh after the mailitem is on display in order to accomodate post-display modifications made to it.

I tried putting multiple mailitem.display at different locations in my code, but it seems to work unreliably.

Any ideas are welcome.

2

There are 2 best solutions below

0
On

You could called EMail Watcher, for example:

With oMail
    .To = addr
    .Subject = "CCAT eVSM Utilities License Code"
    .Body = "Message body"
    .Display
End With
Set CurrWatcher = New EmailWatcher
Set CurrWatcher.BoolRange = Range("G12")
Set CurrWatcher.TheMail = oMail

For more information, Please refer to this link:

VBA Outlook Mail .display, recording when/if sent manuall

0
On

Try doing this. It seems to have the same effect as opening and closing the message manually and causes Outlook to update the view. I use this after programmatically removing attachments so that the Outlook view no longer shows an attachment icon next to the message.

Dim olInspector As Outlook.Inspector
Set olInspector = useYourTargetMailItemVariable.GetInspector
    
Dim targetMsg As Outlook.MailItem
Set targetMsg = olInspector.CurrentItem
    
targetMsg.Close olSave