انتقل إلى المحتوى الرئيسي

كيفية حفظ البريد الإلكتروني كملف pdf في Outlook؟

إذا كنت تعمل مع Microsoft Outlook 2010 و 2007 ، فستجد أنه لا يوجد مضمّن في Outlook لتغيير البريد الإلكتروني إلى تنسيق pdf. تحتاج إلى تحويل البريد الإلكتروني إلى ملف pdf عن طريق بعض الوظائف الإضافية ذات الصلة أو برمز VBA. باستخدام المقالة التالية ، يمكنك بسهولة حفظ البريد الإلكتروني كملف pdf في Outlook.

احفظ البريد الإلكتروني كملف pdf في Outlook برمز VBA

قم بحفظ رسائل بريد إلكتروني متعددة كملف pdf أو تنسيقات ملفات أخرى باستخدام الحفظ المجمعفكرة جيدة 3


احفظ البريد الإلكتروني كملف pdf في Outlook برمز VBA

1. أولاً ، يجب عليك تحديد البريد الإلكتروني الذي تريد حفظه بتنسيق PDF.

2. صحافة ALT + F11 لإطلاق ميكروسوفت فيسوال باسيك للتطبيقات نافذة.

3. انقر إدراج > وحدة، ثم انسخ والصق رمز فبا التالي في نافذة الوحدة النمطية.

رمز 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.


قم بحفظ رسائل بريد إلكتروني متعددة كملف pdf أو تنسيقات ملفات أخرى باستخدام الحفظ المجمع

بدافع 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


أفضل أدوات إنتاجية المكتب

كوتولس لتوقعات - أكثر من 100 ميزة قوية لتعزيز توقعاتك

🤖 مساعد بريد الذكاء الاصطناعي: رسائل بريد إلكتروني احترافية فورية مع سحر الذكاء الاصطناعي - بنقرة واحدة للردود العبقرية، والنغمة المثالية، وإتقان متعدد اللغات. تحويل البريد الإلكتروني دون عناء! ...

📧 أتمتة البريد الإلكتروني: خارج المكتب (متوفر لـ POP وIMAP)  /  جدولة إرسال رسائل البريد الإلكتروني  /  نسخة تلقائية/نسخة مخفية الوجهة حسب القواعد عند إرسال البريد الإلكتروني  /  إعادة التوجيه التلقائي (القواعد المتقدمة)   /  إضافة تحية تلقائية   /  تقسيم رسائل البريد الإلكتروني متعددة المستلمين تلقائيًا إلى رسائل فردية 

📨 إدارة البريد الإلكتروني: استدعاء رسائل البريد الإلكتروني بسهولة  /  حظر رسائل البريد الإلكتروني الاحتيالية حسب الموضوعات والآخرين  /  حذف رسائل البريد الإلكتروني المكررة  /  المزيد من خيارات البحث  /  توحيد المجلدات 

📁 المرفقات بروحفظ دفعة  /  فصل دفعة  /  ضغط دفعة  /  حفظ تلقائي   /  فصل تلقائي  /  ضغط تلقائي 

؟؟؟؟ واجهة ماجيك: 😊 المزيد من الرموز التعبيرية الجميلة والرائعة   /  عزز إنتاجية 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