Outlook Solutions Archive

Do you want to export all the image attachments of an email to a Word document? If you have this requirement, you can refer to this article. Here we’ll teach you how to intelligently realize it step by step.

My previous article “How to Quickly Export All Image Attachments of an Outlook Email to a PDF File” has introduced how to export image attachments to a PDF. However, it is difficult to edit a PDF. Thus, if what you would like to do is to make use of the image attachments to compose an editable Word document, you could read on to get a method.

Quickly Export All Image Attachments of an Outlook Email to a Word Document

Export All Image Attachments of an Email to a Word Document

  1. At the very outset, start your Outlook program.
  2. Then, after accessing Outlook, open the VBA editor window by following the steps shown in the article – “How to Run VBA Code in Your Outlook”.
  3. Next, enable “Microsoft Word Object Library” with reference to “How to Add an Object Library Reference in VBA”.
  4. Subsequently, put the piece of VBA code below into an empty module.
Sub ExportAllImageAttachmentsIntoWordDocument()
    Dim objSourceMail As Outlook.MailItem
    Dim objAttachment As Outlook.Attachment
    Dim objWordApp As Word.Application
    Dim objTempDocument As Word.Document
    Dim strImage As String
    Dim objInlineShape As Word.InlineShape
    Dim strPDF As String
 
    Set objSourceMail = Application.ActiveInspector.CurrentItem
 
    If Not (objSourceMail Is Nothing) Then
 
       Set objWordApp = CreateObject("Word.Application")
       Set objTempDocument = objWordApp.Documents.Add
       objWordApp.Visible = True
       objTempDocument.Activate
 
       strTempFolder = Environ("Temp") & "\" & Format(Now, "yyyymmddhhmmss") & "\"
       MkDir (strTempFolder)
       Set objFileSystem = CreateObject("Scripting.FileSystemObject")
 
       For Each objAttachment In objSourceMail.Attachments
           If IsEmbedded(objAttachment) = False Then
              Select Case LCase(objFileSystem.GetExtensionName(objAttachment.FileName))
                     Case "jpg", "jpeg", "png", "bmp", "gif"
                          objAttachment.SaveAsFile strTempFolder & objAttachment.FileName
              End Select
           End If
       Next
 
       strImage = Dir(strTempFolder & "*.*", vbNormal)

       Do Until Len(strImage) = 0
          With Selection
               .InlineShapes.AddPicture (strTempFolder & strImage)
               .TypeParagraph
               .Collapse Direction:=wdCollapsEnd
               .ParagraphFormat.Alignment = wdAlignParagraphCenter
               .TypeParagraph
          End With
          strImage = Dir()
       Loop

       For Each objInlineShape In objTempDocument.InlineShapes
           objInlineShape.Select
           Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
           objInlineShape.ScaleHeight = 50
           objInlineShape.ScaleWidth = 50
       Next
    End If
End Sub

Function IsEmbedded(objCurAttachment As Outlook.Attachment) As Boolean
    Dim objPropertyAccessor As Outlook.PropertyAccessor
    Dim strProperty As String
 
    Set objPropertyAccessor = objCurAttachment.PropertyAccessor
    strProperty = objPropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E")
 
    If InStr(1, strProperty, "@") > 0 Then
       IsEmbedded = True
    Else
       IsEmbedded = False
    End If
End Function

VBA Code -Export All Image Attachments of an Email to a Word Document

  1. After that, you can continue adding this macro to Quick Access Toolbar.
  2. Later, you should open the source email and then click the macro button in Quick Access Toolbar.
  3. At once, after macro finishes, you’ll get a Word document, like the following screenshot:Export Images in Word Document

Fix Outlook Errors

It’s indeed common for regular users to encounter errors in Outlook. Usually, the first alternative is to utilize the built-in repair tool – Scanpst to resolve them. Yet, if the errors are so serious that they have been beyond what the inbox repair tool can do, you have to resort to a more powerful fix utility, like DataNumen Outlook Repair. It is able to fix Outlook issues effectively.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including sql recovery and outlook repair software products. For more information visit www.datanumen.com

Be the first to comment

Some users would like to export an Outlook email as an image file, such as a jpg file. Therefore, in this article, we will introduce you how to get it via Outlook VBA code.

You must have learned a variety of tricks for exporting an email as text file, Word document and so on. Then, how about exporting an email as picture like JPG file? Apparently, Outlook doesn’t have this function. But, thereinafter, we will share a quick means with you.

Quickly Export an Outlook Email as an Image File

Quickly Export an Outlook Email as an Image File

  1. For a start, launch your Outlook application.
  2. Then, in the main Outlook window, get access to VBA editor with accordance to the article – “How to Run VBA Code in Your Outlook”.
  3. Next, enable “MS Word Object Library” and “MS PowerPoint Object Library” by referring to the article – “How to Add an Object Library Reference in VBA”.
  4. Next, copy and paste the following VBA code into a blank module.
Sub ExportEmailAsImage()
    Dim objMail As Outlook.MailItem
    Dim strFileName As String
    Dim strWordDocument As String
    Dim objWordApp As Word.Application
    Dim objWordDocument As Word.Document
    Dim objDocumentRange As Word.Range
    Dim objPowerPointApp As PowerPoint.Application
    Dim objPresentation As PowerPoint.Presentation
    Dim objShape As PowerPoint.Shape
 
    On Error Resume Next
    'Export the email as Word document
    Set objMail = Outlook.Application.ActiveExplorer.Selection(1)
    strFileName = Replace(objMail.Subject, "/", " ")
    strFileName = Replace(strFileName, "\", " ")
    strFileName = Replace(strFileName, ":", "")
    strFileName = Replace(strFileName, "?", " ")
    strFileName = Replace(strFileName, Chr(34), " ")
    strWordDocument = Environ("Temp") & "\" & strFileName & ".doc"
 
    objMail.SaveAs strWordDocument, olDoc

    Set objWordApp = CreateObject("Word.Application")
    Set objWordDocument = objWordApp.Documents.Open(strWordDocument)
    objWordApp.Visible = True
 
    objWordApp.Selection.Find.ClearFormatting
    objWordApp.Selection.Find.Replacement.ClearFormatting
 
    With objWordApp.Selection.Find
        .Text = "^p^p"
        .Replacement.Text = "^p"
        .Wrap = wdFindContinue
    End With
 
    'Insert the document into a PowerPoint Presentation slide as an object
    objWordApp.Selection.Find.Execute Replace:=wdReplaceAll
    Set objDocumentRange = objWordDocument.Range()
    objDocumentRange.Font.Name = "Calibri"
    objDocumentRange.Font.Size = 10
    objWordDocument.Close True
    objWordApp.Quit
 
    Set objPowerPointApp = CreateObject("PowerPoint.Application")
    Set objPresentation = objPowerPointApp.Presentations.Add
    objPowerPointApp.Visible = msoTrue
 
    With objPresentation
        .PageSetup.SlideHeight = 792
        .PageSetup.SlideWidth = 612
        .Slides.AddSlide 1, .SlideMaster.CustomLayouts(1)
    End With
 
    'Export the slide
    With objPresentation.Slides(1)
         Set objShape = .Shapes.AddOLEObject(0, 0, 612, 792, , strWordDocument)
        .Export "E:\Email_" & strFileName & ".jpg", "JPG"
    End With
 
    objPresentation.Saved = msoTrue
    objPresentation.Close
    objPowerPointApp.Quit
End Sub

VBA Code - Quickly Export an Outlook Email as an Image File

  1. After that, you need to add the macro to Quick Access Toolbar.
  2. Subsequently, you could close the VBA editor.
  3. Later, select an email and hit the macro button in Quick Access Toolbar.Run Macro through Quick Access Toolbar
  4. When macro completes, you can go to the predefined local folder to find the exported image file from this email.Exported Image File

Retrieve Outlook Data from Corrupted File

You may be quite frustrating if your Outlook file is subject to severe damage. In that scenario, you will proceed to extract Outlook data from the compromised file. Some users will tend to make use of the inbox repair tool. Yet, most of time, it will not make effects. Therefore, you had better keep a formidable and reliable PST fix tool, such as DataNumen Outlook Repair. It can scan the corrupt file and get back maximum data without any fusses.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including mdf fix and outlook repair software products. For more information visit www.datanumen.com

Be the first to comment

Some users would like to change the styles of all tables in an Outlook email in bulk, rather than selecting tables and changing styles one by one. Now, in this article, we will introduce 2 means to you.

At times, you copied some tables to an email from other sources. If you dislike the original styles of these tables, you may want to change them. You may be used to modifying them one by one. However, it is too troublesome if there are numerous tables in this email. Thereby, here we will share you 2 methods to accomplish this in one go.

2 Methods to Batch Change the Styles of All Tables in an Outlook Email

Method 1: Batch Change the Styles of All Tables Manually

  1. First off, open the source email.
  2. If the email is not the one that you are composing, you should turn into the “Edit Mode” firstly. Click “Actions” > “Edit Message”.
  3. Then, you should keep holding down “Ctrl” button and select the tables in the email one by one.Select All Tables
  4. After that, you can switch to “Design” tab under “Table Tools” ribbon.
  5. Next, in the “Table Styles” group, you should select a target table style as per your needs.Select a Target Table Style
  6. At once, the styles of all the tables are changed, like the following screenshot:Changed Table Styles

If there are few tables in this email, this method is still simple and convenient. Yet, if the email contains a great amount of tables, such as 20 or more, selecting them one by one is too tedious. In that case, you apply the VBA code to accomplish it in batches.

Method 2: Batch Change the Styles of All Tables via Outlook VBA

  1. In the first place, access VBA editor according to “How to Run VBA Code in Your Outlook”.
  2. next, enable “MS Word Object Library” with reference to “How to Add an Object Library Reference in VBA“.
  3. Then, put the following VBA code into a module.
Sub BatchChangeStylesOfAllTables ()
    Dim objMail As Outlook.MailItem
    Dim objMailDocument As Word.Document
    Dim objTables As Word.Tables
    Dim objTable As Word.Table
 
    'Get the currently opened email
    Set objMail = Outlook.Application.ActiveInspector.CurrentItem
    Set objMailDocument = objMail.GetInspector.WordEditor
 
    'Get all the tables of the current email
    Set objTables = objMailDocument.Tables
 
    'Convert all tables to text
    For Each objTable In objTables
        'Specify the name of the table style
        objTable.Style = "Light Shading - Accent 3"
    Next
End Sub

VBA Code - Batch Change the Styles of All Tables

  1. After that, add the macro to Quick Access Toolbar.
  2. Finally, all the tables’ styles will be changed to the predefined style.All Table Gets Changed via Macro

Equip Your Outlook with a Formidable Repair Tool

Although Outlook comes pre-installed with a built-in repair tool – Scanpst, you’d better not rely on it completely. It is because that this internal utility is only able to deal with small glitches. It’ll definitely fail in coping with severe situations. So, it is essential for us to keep another PST repair utility in vicinity, like DataNumen Outlook Repair. It can fix Outlook issues without breaking a sweat.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including sql corruption and outlook repair software products. For more information visit www.datanumen.com

Be the first to comment