How to Quickly Export All Image Attachments of an Outlook Email to a PowerPoint Presentation

Some users would like to use the image attachments of a receive email to make a PowerPoint presentation. In this case, they want to quickly export these images into a new PPT file. Here we will introduce an approach to achieve this rapidly.

My previous article “How to Quickly Export All Image Attachments of an Outlook Email to a PDF File” has introduced a quick means to combine pictures into a PDF file. Similar to that, many users hope to swiftly export such images into a PPT file in that they want to use these images for a new PowerPoint presentation. Hence, here we will show another piece of VBA code which can realize it within seconds.

Quickly Export All Image Attachments of an Outlook Email to a PowerPoint Presentation

Export All Image Attachments of an Email into a PowerPoint Presentation

  1. At the very outset, start your Outlook program.
  2. Then, you ought to press “Alt + F11” key buttons in Outlook.
  3. Next, you will get access to Outlook VBA editor window, in which you should enable “Microsoft PowerPoint Object Library”.
  4. Then, you need to open a module that is not being used or just insert a new one.
  5. After that, you could copy and paste the following VBA code into this module.
Sub ExportAllImageAttachmentsToPPT()
    Dim objSourceMail As Outlook.MailItem
    Dim objAttachment As Outlook.Attachment
    Dim strImage As String
    Dim objPowerPointApp As PowerPoint.Application
    Dim objPresentation As PowerPoint.Presentation
    Dim objSlide As PowerPoint.Slide
    Dim objPicture As PowerPoint.Shape
 
    Select Case Outlook.Application.ActiveWindow.Class
           Case olInspector
                Set objSourceMail = ActiveInspector.currentItem
           Case olExplorer
                Set objSourceMail = ActiveExplorer.Selection.Item(1)
    End Select
 
    If Not (objSourceMail Is Nothing) Then
 
       'Save the image attachments to a temporary folder
       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
 
       'Create a new PowerPoint Presentation
       Set objPowerPointApp = CreateObject("PowerPoint.Application")
       Set objPresentation = objPowerPointApp.Presentations.Add
       objPowerPointApp.Visible = msoCTrue
 
       'Insert the saved images into the Presentation
       'One Image per Page
       strImage = Dir(strTempFolder & "*.*", vbNormal)

       Do Until Len(strImage) = 0
          Set objSlide = objPresentation.Slides.Add(objPresentation.Slides.count + 1, ppLayoutBlank)
          Set objPicture = objSlide.Shapes.AddPicture(filename:=strTempFolder & strImage, LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=0, Top:=0, Width:=-1, Height:=-1)
 
          'Fit the Image Size with the Slide Page
          With objPicture
               If 3 * .Width > 4 * .Height Then
                  .Width = objPresentation.PageSetup.SlideWidth
                  .Top = 0.5 * (objPresentation.PageSetup.SlideHeight - .Height)
               Else
                  .Height = objPresentation.PageSetup.SlideHeight
                  .Left = 0.5 * (objPresentation.PageSetup.SlideWidth - .Width)
               End If
          End With
 
          strImage = Dir()
       Loop
    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 into a PowerPoint Presentation

  1. Subsequently, you can run this macro. Just press “F5” key button.
  2. At once, the macro will run. When it completes, you will see a new PPT file in the background. It will look like the following picture:Exported PowerPoint Presentation

What Can Recover Corrupt PST Files

Many times, Outlook errors can get recovered simply via a restart. Yet, although it hasn’t hurt your cherished data, you can’t overlook this glitch. It usually indicates an impending Outlook crash. One day, if you’re faced with abrupt crashes and PST file gets compromised, you’ll be required to make efforts to fix it. For example, it is advisable to use an external reliable and experienced tool, such as DataNumen Outlook Repair. It can rescue you from Outlook corruption within minutes.

Author Introduction:

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

One response to “How to Quickly Export All Image Attachments of an Outlook Email to a PowerPoint Presentation”