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

Kako shraniti e-poštno sporočilo kot obliko slike (jpg / tiff) v Outlook?

Ste že kdaj poskušali e-poštno sporočilo shraniti kot sliko, kot je slika jpg ali tiff v Outlooku? Ta članek vam bo pokazal način reševanja te težave.

Shranite e-poštno sporočilo kot obliko slike s kodo VBA


Shranite e-poštno sporočilo kot obliko slike s kodo VBA

Naredite naslednje, če želite shraniti e-poštno sporočilo kot obliko slike v programu Outlook.

1. Izberite e-poštno sporočilo, ki ga boste shranili kot sliko, in pritisnite na druga + F11 tipke hkrati, da odprete Microsoft Visual Basic za aplikacije okno.

2. V Ljubljani Microsoft Visual Basic za aplikacije okno, kliknite Vstavi > Uporabniški obrazec. Oglejte si posnetek zaslona:

3. Ustvariti Uporabniška oblika kot je prikazano spodaj.

4. Izberite jpg Možnost in spremenite njegovo ime v opbJPG na levi Nepremičnine okno.

5. Ponovite zgornji korak 4, da gumb druge možnosti preimenujete v opbTIFF. In preimenujte OK ukazni gumb in Prekliči ukazni gumb kot cdbOk in cdbOdpovedi ločeno.

Opombe: Če je Nepremičnine podokno ni prikazano v Microsoft Visual Basic za aplikacije kliknite okno F4 tipka za prikaz okna.

6. Dvokliknite poljuben prazen prostor na uporabniškem obrazcu, da odprete Koda okno. Vso kodo zamenjajte z naslednjim skriptom VBA. Nato zaprite okno Code.

Koda VBA 1: shranite e-poštno sporočilo kot sliko

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