ไปยังเนื้อหาหลัก

วิธีบันทึกอีเมลเป็นไฟล์ pdf ใน Outlook

หากคุณกำลังทำงานกับ Microsoft Outlook 2010 และ 2007 คุณจะพบว่าไม่มี build-in ใน Outlook ให้เปลี่ยนอีเมลเป็นรูปแบบ pdf คุณต้องแปลงอีเมลเป็นไฟล์ pdf โดยใช้ Add-in ที่เกี่ยวข้องหรือด้วยรหัส VBA ด้วยบทความต่อไปนี้คุณจะบันทึกอีเมลเป็นไฟล์ pdf ใน Outlook ได้อย่างง่ายดาย

บันทึกอีเมลเป็นไฟล์ pdf ใน Outlook ด้วยรหัส VBA

Bulk บันทึกอีเมลหลายฉบับเป็นไฟล์ pdf หรือรูปแบบไฟล์อื่น ๆ ด้วย Bulk Saveความคิดที่ดี 3


บันทึกอีเมลเป็นไฟล์ pdf ใน Outlook ด้วยรหัส VBA

1. อันดับแรกคุณควรเลือกอีเมลที่คุณต้องการบันทึกเป็น PDF

2 กด Alt + F11 เพื่อเริ่มต้น Microsoft Visual Basic สำหรับแอปพลิเคชัน หน้าต่าง

3 คลิก สิ่งที่ใส่เข้าไป > โมดูลจากนั้นคัดลอกและวางโค้ด VBA ต่อไปนี้ลงในหน้าต่างโมดูล

รหัส VBA ของการบันทึกอีเมลเป็นไฟล์ PDF:

Sub SaveAsPDFfile()
Dim MyOlNamespace As NameSpace
Dim MySelectedItem As MailItem
Dim Response As String
Dim FSO As Object, TmpFolder As Object
Dim tmpFileName As String
Dim wrdApp As Object
Dim wrdDoc As Object
Dim bStarted As Boolean
Dim dlgSaveAs As FileDialog
Dim fdfs As FileDialogFilters
Dim fdf As FileDialogFilter
Dim i As Integer
Dim WshShell As Object
Dim SpecialPath As String
Dim msgFileName As String
Dim strCurrentFile As String
Dim strName As String
Dim oRegEx As Object
Dim intPos As Long
Set MyOlNamespace = Application.GetNamespace("MAPI")
Set MySelectedItem = ActiveExplorer.Selection.Item(1)
Set FSO = CreateObject("Scripting.FileSystemObject")
tmpFileName = FSO.GetSpecialFolder(2)
strName = "email_temp.mht"
tmpFileName = tmpFileName & "\" & strName
MySelectedItem.SaveAs tmpFileName, 10
On Error Resume Next
Set wrdApp = GetObject(, "Word.Application")
If Err Then
Set wrdApp = CreateObject("Word.Application")
bStarted = True
End If
On Error GoTo 0
Set wrdDoc = wrdApp.Documents.Open(FileName:=tmpFileName, Visible:=False, Format:=7)
Set dlgSaveAs = wrdApp.FileDialog(msoFileDialogSaveAs)
Set fdfs = dlgSaveAs.Filters
i = 0
For Each fdf In fdfs
i = i + 1
If InStr(1, fdf.Extensions, "pdf", vbTextCompare) > 0 Then
Exit For
End If
Next fdf
dlgSaveAs.FilterIndex = i
Set WshShell = CreateObject("WScript.Shell")
SpecialPath = WshShell.SpecialFolders(16)
msgFileName = MySelectedItem.Subject
Set oRegEx = CreateObject("vbscript.regexp")
oRegEx.Global = True
oRegEx.Pattern = "[\/:*?""<>|]"
msgFileName = Trim(oRegEx.Replace(msgFileName, ""))
dlgSaveAs.InitialFileName = SpecialPath & "\" & msgFileName
If dlgSaveAs.Show = -1 Then
strCurrentFile = dlgSaveAs.SelectedItems(1)
If Right(strCurrentFile, 4) <> ".pdf" Then
Response = MsgBox("Sorry, only saving in the pdf-format is supported." & _
vbNewLine & vbNewLine & "Save as pdf instead?", vbInformation + vbOKCancel)
If Response = vbCancel Then
wrdDoc.Close 0
If bStarted Then wrdApp.Quit
Exit Sub
ElseIf Response = vbOK Then
intPos = InStrRev(strCurrentFile, ".")
If intPos > 0 Then
strCurrentFile = Left(strCurrentFile, intPos - 1)
End If
strCurrentFile = strCurrentFile & ".pdf"
End If
End If
wrdApp.ActiveDocument.ExportAsFixedFormat OutputFileName:= _
strCurrentFile, _
ExportFormat:=17, _
OpenAfterExport:=False, _
OptimizeFor:=0, _
Range:=0, _
From:=0, _
To:=0, _
Item:=0, _
IncludeDocProps:=True, _
KeepIRM:=True, _
CreateBookmarks:=0, _
DocStructureTags:=True, _
BitmapMissingFonts:=True, _
UseISO19005_1:=False
End If
Set dlgSaveAs = Nothing
wrdDoc.Close
If bStarted Then wrdApp.Quit
Set MyOlNamespace = Nothing
Set MySelectedItem = Nothing
Set wrdDoc = Nothing
Set wrdApp = Nothing
Set oRegEx = Nothing
End Sub

หมายเหตุ: โค้ด VBA นี้ทดสอบสำเร็จแล้วใน Outlook 2007 และ 2010

4 คลิก เพื่อเรียกใช้รหัส

5. จะมี บันทึกไฟล์ กล่องโต้ตอบปรากฏขึ้นในขณะที่รหัสกำลังทำงาน เลือกเส้นทางเพื่อบันทึกไฟล์ตั้งชื่อและสุดท้ายคลิกที่ ลด ปุ่ม

6. เมื่อโค้ดทำงานเสร็จแล้วอีเมลได้แปลงเป็นไฟล์ pdf เรียบร้อยแล้ว


Bulk บันทึกอีเมลหลายฉบับเป็นไฟล์ pdf หรือรูปแบบไฟล์อื่น ๆ ด้วย Bulk Save

กับ Kutools for Outlook ติดตั้งแล้วคุณสามารถใช้ไฟล์ Bulk Save ยูทิลิตี้เพื่อบันทึกหรือส่งออกอีเมลที่เลือกไปยังไฟล์ PDF / ไฟล์ Excel / ไฟล์ CSV หรือรูปแบบไฟล์อื่น ๆ ได้อย่างรวดเร็ว

Kutools for Outlook, รวมถึง คุณสมบัติและเครื่องมือที่มีประสิทธิภาพสำหรับ Microsoft Outlook 2019, 2016, 2013, 2010 และ Office 365

1. ในโฟลเดอร์อีเมลเลือกข้อความที่คุณต้องการบันทึกเป็น PDF คลิก Kutools > Bulk Save.
doc kutools จำนวนมากบันทึก 1

2 ใน Bulk Save กล่องโต้ตอบเลือกเส้นทางเพื่อวางไฟล์ใหม่ตรวจสอบ PDF formatและคุณสามารถระบุไฟล์ Save content ตามที่คุณต้องการ
doc บันทึกอีเมลเป็น pdf 4

3 คลิก Ok. จากนั้นอีเมลที่เลือกจะถูกบันทึกเป็นไฟล์ PDF ทีละไฟล์
doc บันทึกอีเมลเป็น pdf 5


สุดยอดเครื่องมือเพิ่มผลผลิตในสำนักงาน

Kutools สำหรับ Outlook - คุณสมบัติอันทรงพลังมากกว่า 100 รายการเพื่อเติมพลังให้กับ Outlook ของคุณ

🤖 ผู้ช่วยจดหมาย AI: ส่งอีเมลระดับมืออาชีพทันทีด้วยเวทมนตร์ AI คลิกเพียงครั้งเดียวเพื่อตอบกลับอย่างชาญฉลาด น้ำเสียงที่สมบูรณ์แบบ การเรียนรู้หลายภาษา เปลี่ยนรูปแบบการส่งอีเมลอย่างง่ายดาย! ...

📧 การทำงานอัตโนมัติของอีเมล: ไม่อยู่ที่สำนักงาน (ใช้ได้กับ POP และ IMAP)  /  กำหนดการส่งอีเมล  /  Auto CC/BCC ตามกฎเมื่อส่งอีเมล  /  ส่งต่ออัตโนมัติ (กฎขั้นสูง)   /  เพิ่มคำทักทายอัตโนมัติ   /  แบ่งอีเมลผู้รับหลายรายออกเป็นข้อความส่วนตัวโดยอัตโนมัติ ...

📨 การจัดการอีเมล์: เรียกคืนอีเมลได้อย่างง่ายดาย  /  บล็อกอีเมลหลอกลวงตามหัวเรื่องและอื่นๆ  /  ลบอีเมลที่ซ้ำกัน  /  การค้นหาขั้นสูง  /  รวมโฟลเดอร์ ...

📁 ไฟล์แนบโปรบันทึกแบทช์  /  การแยกแบทช์  /  การบีบอัดแบบแบตช์  /  บันทึกอัตโนมัติ   /  ถอดอัตโนมัติ  /  บีบอัดอัตโนมัติ ...

🌟 อินเตอร์เฟซเมจิก: 😊อีโมจิที่สวยและเจ๋งยิ่งขึ้น   /  เพิ่มประสิทธิภาพการทำงาน Outlook ของคุณด้วยมุมมองแบบแท็บ  /  ลดขนาด Outlook แทนที่จะปิด ...

???? เพียงคลิกเดียวสิ่งมหัศจรรย์: ตอบกลับทั้งหมดด้วยไฟล์แนบที่เข้ามา  /   อีเมลต่อต้านฟิชชิ่ง  /  🕘 แสดงโซนเวลาของผู้ส่ง ...

👩🏼‍🤝‍👩🏻 รายชื่อและปฏิทิน: แบทช์เพิ่มผู้ติดต่อจากอีเมลที่เลือก  /  แบ่งกลุ่มผู้ติดต่อเป็นกลุ่มแต่ละกลุ่ม  /  ลบการแจ้งเตือนวันเกิด ...

เกิน คุณสมบัติ 100 รอการสำรวจของคุณ! คลิกที่นี่เพื่อค้นพบเพิ่มเติม

 

 

Comments (11)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
or (but for this you need to open the mail) you could use this:
ActiveInspector.WordEditor.ExportAsFixedFormat "c:\temp\test.pdf",ExportFormat:=17, OpenAfterExport:=False, OptimizeFor:=0, Range:=0, From:=0, To:=0, Item:=0, IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:=0, DocStructureTags:=True, BitmapMissingFonts:=True, UseISO19005_1:=False

This comment was minimized by the moderator on the site
Hi !!
I have follow all the instructions but it doesn't work, " Compile error : Syntax error"
Can you help me ? Please
Amaury
This comment was minimized by the moderator on the site
This macro is really great and easy to use as well,thank you so much for sharing this.
Just wanted to check is it possible to create same kind of macro for PDF attachment as well,because the above macro works only for excel and word format.

Can any one one help me on this.
This comment was minimized by the moderator on the site
I am wondering how I could change the folder the pdf goes to and change the filename(since all the emails I am copying are called the same thing
This comment was minimized by the moderator on the site
Been wondering how to do this for years, very easy, thank you
This comment was minimized by the moderator on the site
Hi All, PDF is saving in default size and I can't see all text, tables, etc. from email. How can I fix that? Is it any way to save email as PDF file in responsive size?
This comment was minimized by the moderator on the site
The VBA code works perfectly! Now, is there any way to adjust this in order to default "save as" to be .msg in Outlook 2007?
This comment was minimized by the moderator on the site
I have been able to use this. But now when I run it is just saving a copy of this page. I get a PDF of the instructions rather than the email I was trying to convert. Any suggestions?
This comment was minimized by the moderator on the site
Super, worked like a charm. Thank you very much
This comment was minimized by the moderator on the site
Many thanks, friend. This was a great help.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations