Note: The other languages of the website are Google-translated. Back to English

Come salvare un messaggio di posta elettronica come formato immagine (jpg / tiff) in Outlook?

Hai mai provato a salvare un messaggio di posta elettronica come immagine come jpg o immagine tiff in Outlook? Questo articolo ti mostrerà un metodo per risolvere questo problema.

Salva il messaggio di posta elettronica come formato immagine con codice VBA


Salva il messaggio di posta elettronica come formato immagine con codice VBA

Si prega di fare quanto segue per salvare un messaggio di posta elettronica come formato immagine in Outlook.

1. Selezionare un'e-mail da salvare come immagine, quindi premere il tasto altro + F11 tasti contemporaneamente per aprire il file Microsoft Visual Basic, Applications Edition finestra.

2. Nel Microsoft Visual Basic, Applications Edition finestra, fare clic inserire > Modulo utente. Vedi screenshot:

3. Creare un Modulo utente come mostrato nell'immagine sottostante.

4. Seleziona il Opzione jpg e cambiarne il nome in opbJPG sulla sinistra Proprietà riquadro.

5. Ripetere il passaggio 4 precedente per rinominare il pulsante delle altre opzioni come opbTIFF. E rinomina il file OK pulsante di comando e il Annulla pulsante di comando come cdbOk e cdbAnnulla separatamente.

Note:: Se la Proprietà il riquadro non viene visualizzato nel file Microsoft Visual Basic, Applications Edition finestra, fare clic su F4 tasto per visualizzare il riquadro.

6. Fare doppio clic su uno spazio vuoto nel modulo utente per aprire il file Codice finestra. Sostituisci tutto il codice con il seguente script VBA. Quindi chiudi la finestra del codice.

Codice VBA 1: salva il messaggio di posta elettronica come immagine

Option Explicit
'Update by Extendoffice 2018/3/5
Public xRet As Boolean
Private Sub cdbCancel_Click()
  xRet = False
  FrmPicType.Hide
End Sub
Private Sub cdbOk_Click()
  xRet = True
  FrmPicType.Hide
End Sub

7. Select the UserForm1 and change its name to FrmPicType in the Properties pane as below screenshot shown.

8. Click Insert > Module, and then copy the below VBA code into the Module window.

VBA code 2: Save email message as picture

Public Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'Update by Extendoffice 2018/3/5
Sub ExportEmailAsImage()
Dim xMail As Outlook.MailItem
Dim xFileName, xFilePath, xWdDocPath As String
Dim xPPTApp As PowerPoint.Application
Dim xPresentation As PowerPoint.Presentation
Dim xPPTShape As PowerPoint.Shape
Dim xPicType As String
Dim xFileFormat As PpSaveAsFileType
On Error Resume Next
FrmPicType.Show
If FrmPicType.xRet Then
  If FrmPicType.opbJPG.Value = True Then
    xPicType = ".jpg"
    xFileFormat = ppSaveAsJPG
  ElseIf FrmPicType.opbTIFF.Value = True Then
    xPicType = ".tiff"
    xFileFormat = ppSaveAsTIF
  End If
Else
  Exit Sub
End If
Set xShell = CreateObject("Shell.Application")
Set xFolder = xShell.BrowseForFolder(0, "Select a folder:", 0, 0)
If Not TypeName(xFolder) = "Nothing" Then
    Set xFolderItem = xFolder.self
    xFilePath = xFolderItem.Path & "\"
Else
    xFilePath = ""
    Exit Sub
End If
'ShellExecute 0, "Open", "POWERPNT.exe", "", "", 0
Set xPPTApp = New PowerPoint.Application
xPPTApp.Height = 0
xPPTApp.Width = 0
xPPTApp.WindowState = ppWindowMinimized
xPPTApp.Visible = msoFalse
For Each xMail In Outlook.Application.ActiveExplorer.Selection
    xFileName = Replace(xMail.Subject, "/", " ")
    xFileName = Replace(xFileName, "\", " ")
    xFileName = Replace(xFileName, ":", "")
    xFileName = Replace(xFileName, "?", " ")
    xFileName = Replace(xFileName, Chr(34), " ")
    xWdDocPath = Environ("Temp") & "\" & xFileName & ".doc"
    xMail.SaveAs xWdDocPath, olDoc
    
    Set xPresentation = xPPTApp.Presentations.Add
    xPresentation.Application.WindowState = ppWindowMinimized
    xPresentation.Application.Visible = msoFalse
    With xPresentation
        .PageSetup.SlideHeight = 900 '792
        .PageSetup.SlideWidth = 612
        .Slides.AddSlide 1, .SlideMaster.CustomLayouts(1)
    End With
    xPPTApp.WindowState = ppWindowMinimized
    With xPresentation.Slides(1)
         .Application.Visible = msoFalse
         Set xPPTShape = .Shapes.AddOLEObject(0, 0, 612, 900, , xWdDocPath)
         xPresentation.SaveAs xFilePath & xFileName & xPicType, xFileFormat, msoTrue
    End With
    xPresentation.Close
Next
xPPTApp.Quit
MsgBox "Mails has been successfully saved as picture", vbInformation + vbOKOnly
End Sub

9. Click Tools > References, check the Microsoft PowerPoint Object Library box and then click the OK button. See screenshot:

10. Press the F5 key to run the code. Then the UserForm1 dialog box pops up, please select a picture type and click the OK button. See screenshot:

11. In the Browse For Folder dialog box, specify a folder to save the picture, and then click the OK button.

12. Finally, a Microsoft Outlook dialog box will display to tell you about the completion of the saving. Please click the OK button.

Now the selected emails are converted to a jpg or tiff picture and saved into a specified folder successfully.


Related Articles:


Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
  • Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
  • Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
 
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations

Follow Us

Copyright © 2009 - www.extendoffice.com. | All rights reserved. Powered by ExtendOffice. | Sitemap
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Protected by Sectigo SSL