At times, when viewing an email in Outlook, you may want to batch hide all objects inserted to see texts only. Here this article will teach you how to realize it with VBA.
You must have ever received an email which contains many images or tables in body. More often than, too many such embedded objects will disturb you viewing the textual contents of the email. Hence, at this time, you would like to batch hide them and get them back later after finishing viewing the texts. Now, thereinafter, we will guide you to achieve this function.
Batch Hide or Show All Embedded Objects
- For a start, tap on “Alt + F11” keys to access VBA editor.
- In the new window, enable “Microsoft Word Object” according to the post – “How to Add an Object Library Reference in VBA“.
- Next, put the VBA code into a module which is not in use.
Sub BatchHideEmbeddedObjectsInEmail() Dim objMail As Outlook.MailItem Dim objMailDocument As Word.Document Dim objInlineShape As Word.InlineShape Dim objTable As Word.Table Set objMail = Application.ActiveInspector.CurrentItem Set objMailDocument = objMail.GetInspector.WordEditor 'Hide all inline pictures and tables With objMailDocument For Each objInlineShape In .InlineShapes objInlineShape.Range.Font.Hidden = True Next For Each objTable In .Tables objTable.Range.Font.Hidden = True Next End With End Sub Sub BatchShowEmbeddedObjectsInEmail() Dim objMail As Outlook.MailItem Dim objMailDocument As Word.Document Dim objInlineShape As Word.InlineShape Dim objTable As Word.Table Set objMail = Application.ActiveInspector.CurrentItem Set objMailDocument = objMail.GetInspector.WordEditor 'Show all inline pictures and tables With objMailDocument For Each objInlineShape In .InlineShapes objInlineShape.Range.Font.Hidden = False Next For Each objTable In .Tables objTable.Range.Font.Hidden = False Next End With End Sub
- After that, add the two macros to Quick Access Toolbar of Message window by referring to “How to Run VBA Code in Your Outlook“.
- Eventually, try this macro.
- At first, open an email.
- Then, click “Actions” > “Edit Message”.
- After that, click the “BatchHideEmbeddedObjectsInEmail” macro button in Quick Access Toolbar.
- At once, all the inline images and tables will be hidden.
- To show all hidden objects, hit the “BatchHideEmbeddedObjectsInEmail” macro button.
Back Up Your Outlook Data at Regular Intervals
Although Outlook earns a lot of kudos due to its excellent functions, it’s unable to get rid of a deadly flaw – vulnerabilities. It can be compromised for various issues, including virus, system failures, and hardware faults and so on. Hence, it is highly advisable to make regular Outlook data backups. It can help you avoid vexing PST recovery. If without it, you have to recur to an experienced external fix tool, such as DataNumen Outlook Repair. It can fix PST file within minutes.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including SQL Server fix and outlook repair software products. For more information visit www.datanumen.com