
How to display animated content in email
tags: 2007, 2010, animated, animation, browser, display, GIF, image, Outlook, preview
0 comments | Add a comment
In Microsoft Outlook 2007 and 2010, Microsoft disabled the support for GIF files in the mesage body due to the security issue in letting malicious code being inserted into these files. If the senders is not included in the list of trusted senders, the GIF image will display in the message without the moving picture (first frame only).
To display the animated content in the preview you need to execute the below process that will transfer the message to the internet browser.
Code:
Sub Open_in_browser()
Dim Convert As Boolean: Convert = False
Dim ChangetoHTML As Boolean: ChangetoHTML = True
Dim OutlookConvert As Boolean: OutlookConvert = True
Dim LineHTML$, objFile As Object, Selected As Outlook.Selection
Dim FSO As Object, FileName As Variant
Dim Browser$: Browser = "C:\Program Files\Internet Explorer\iexplore.exe"
'you can change the browser by providing an alternative link
Set FSO = CreateObject("scripting.filesystemobject")
Set FileName = FSO.GetSpecialFolder(2)
Dim MarkedMessage As MailItem
Set Selected = Application.ActiveExplorer.Selection
If Selected.Count = 0 Then
MsgBox "Choose message!", vbExclamation, "VBATools": Exit Sub
ElseIf Selected.Count > 1 Then
MsgBox "Choose ONE message only!", vbExclamation, "VBATools": Exit Sub
End If
Set SelectedMessage = Selected.item(1)
If SelectedMessage.BodyFormat = olFormatHTML And Convert = False Then
LineHTML = SelectedMessage.HTMLBody
If ChangetoHTML = False Then
OutlookConvert = False
Else
If InStr(UCase(LineHTML), UCase("src=""cid:")) = 0 Then OutlookConvert = False
End If
End If
FileName = FileName & "\" & "VBATools.htm"
If OutlookConvert = False Then
Set objFile = FSO.CreateTextFile(FileName, True)
objFile.Write "" & LineHTML
objFile.Close
Set objFile = Nothing
Else
SelectedMessage.SaveAs FileName, olHTML
End If
Shell Browser & " " & FileName, vbNormalFocus
Set FSO = Nothing
Set FileName = Nothing
Set Selected = Nothing
Set SelectedMessage = Nothing
End
In order to use the above code convenienty, you can mount the process ro a buttin in the toolbar of Microsoft Outlook. You can read how to do it in the article Installation and running macros.
© All rights reserved. No part or whole of this article may not be reproduced or published without prior permission.