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

كيف تسرد جميع أسماء المرفقات في نص الرسالة عند إنشاء بريد إلكتروني في Outlook؟

هل هناك أي طرق جيدة لإدراج جميع أسماء المرفقات في نص الرسالة عند إنشاء رسالة بريد إلكتروني في Outlook؟ في هذه المقالة سوف أتحدث عن كيفية حل هذه الوظيفة في Outlook.

أدرج جميع أسماء المرفقات في نص الرسالة عند إنشاء بريد إلكتروني برمز VBA

أدرج جميع أسماء المرفقات في نص الرسالة عند إنشاء بريد إلكتروني بميزة بسيطة


أدرج جميع أسماء المرفقات في نص الرسالة عند إنشاء بريد إلكتروني برمز VBA

يرجى اتباع الخطوات التالية لإنهاء هذه المهمة:

1. اضغط باستمرار على ALT + F11 مفاتيح لفتح ميكروسوفت فيسوال باسيك للتطبيقات نافذة.

2. في ميكروسوفت فيسوال باسيك للتطبيقات نافذة ، انقر مرتين هذه الجلسة من مشروع 1 (VbaProject.OTM) لفتح الوضع ، ثم انسخ الكود التالي والصقه في الوحدة النمطية الفارغة.

رمز فبا: أدرج جميع أسماء المرفقات في نص الرسالة:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim xMailItem As MailItem
    If Item.Class = olMail Then
        Set xMailItem = Item
        If xMailItem.Attachments.Count > 0 Then
          AddAttachmentNamesToBody
        End If
    End If
    End Sub

3. ثم استمر في النقر إدراج > وحدة، انسخ والصق الكود أدناه في الوحدة الفارغة المفتوحة ، انظر لقطة الشاشة:

رمز فبا: أدرج جميع أسماء المرفقات في نص الرسالة:

Public Sub AddAttachmentNamesToBody()
    Dim xMailItem As MailItem
    Dim xAttachment As Attachment
    Dim xFileName As String
   Dim xInspector As Outlook.Inspector
    Dim xDoc As Word.Document
    Dim xWdSelection As Word.Selection
    On Error Resume Next
    Set xMailItem = Outlook.ActiveInspector.CurrentItem
    If xMailItem.Attachments.Count = 0 Then
        Exit Sub
    End If
    xFileName = ""
    For Each xAttachment In xMailItem.Attachments
        If xFileName = "" Then
            xFileName = " <" & xAttachment.FileName & "> "
        Else
            xFileName = xFileName & vbCrLf & " <" & xAttachment.FileName & "> "
        End If
    Next xAttachment
    Set xInspector = Outlook.Application.ActiveInspector()
    Set xDoc = xInspector.WordEditor
    Set xWdSelection = xDoc.Application.Selection
    xWdSelection.HomeKey Unit:=wdStory
    xWdSelection.InsertBefore "Attachments: " & vbCrLf & xFileName & vbCrLf & vbCrLf
    Set xMailItem = Nothing
    End Sub

4. ثم انقر فوق الأدوات > مراجع حسابات في ال ميكروسوفت فيسوال باسيك للتطبيقات نافذة في الخارج المراجع - مشروع 1 مربع الحوار ، تحقق مكتبة كائنات Microsoft Word الخيار من المراجع المتاحة مربع القائمة ، انظر لقطة الشاشة:

5. انقر OK للخروج من مربع الحوار، يجب عليك إضافة زر الماكرو إلى شريط أدوات الوصول السريع. في الجديد الرسالة نافذة ، اختر المزيد من الأوامر من تخصيص شريط أدوات الوصول السريع المنسدلة ، انظر لقطة الشاشة:

6. في خيارات التوقعات في مربع الحوار ، قم بالعمليات التالية:

(1.) حدد وحدات الماكرو من اختر الأوامر من قائمة منسدلة؛

(2.) انقر فوق اسم الماكرو الذي قمت بإدراجه الآن؛

(3.) ثم انقر فوق أضف زر لإضافة الماكرو إلى تخصيص شريط أدوات الوصول السريع.

7. ثم اضغط OK لإغلاق مربع الحوار، تم الآن إدراج زر الماكرو في مربع الحوار شريط أدوات الوصول السريع، انظر لقطة الشاشة:

8. الآن، عند إنشاء رسالة جديدة، والنقر فوق زر الماكرو، سيتم إدراج أسماء المرفقات أعلى نص الرسالة كما هو موضح في لقطة الشاشة التالية:


أدرج جميع أسماء المرفقات في نص الرسالة عند إنشاء بريد إلكتروني بميزة بسيطة

قد يكون من الصعب جدًا تطبيق الكود أعلاه، إذا كان لديك كوتولس لتوقعات، بما لديها نسخ الأسماء الميزة، يمكنك نسخ أسماء مرفقات الرسالة بسرعة ولصقها في أي مكان تريده.

ملحوظة:لتطبيق هذا نسخ الأسماءأولاً ، يجب عليك تنزيل ملف كوتولس لتوقعات، ثم قم بتطبيق الميزة بسرعة وسهولة.

بعد تثبيت كوتولس لتوقعات، يرجى القيام بذلك على النحو التالي:

1. أولاً، يرجى إنشاء البريد الإلكتروني الجديد الذي تحتاجه، ثم انقر فوق كوتولس > نسخ الأسماء في الجديد الرسالة نافذة ، انظر لقطة الشاشة:

2. وبعد ذلك، سيظهر مربع مطالبة لتذكيرك بأنه تم نسخ أسماء المرفقات إلى الحافظة، انظر لقطة الشاشة:

3. الآن، تحتاج فقط إلى الضغط CTRL + V المفاتيح معًا للصق أسماء المرفقات في نص الرسالة التي تحتاجها، انظر لقطة الشاشة:


المزيد من المقالات ذات الصلة:

  • الرد على الكل بالمرفقات الأصلية في Outlook
  • عادةً ، عند تطبيق وظيفة "الرد على الكل" للرد على الرسالة لجميع المستلمين في Outlook ، ستفقد المرفقات الأصلية تلقائيًا. هل من الممكن إرفاق المرفقات الأصلية عند الرد على الكل في Outlook؟
  • تنزيل/حفظ المرفقات من Outlook إلى مجلد معين
  • بشكل عام ، يمكنك حفظ جميع مرفقات بريد إلكتروني واحد بالنقر فوق المرفقات> حفظ جميع المرفقات في Outlook. ولكن ، إذا كنت بحاجة إلى حفظ جميع المرفقات من جميع رسائل البريد الإلكتروني المستلمة ورسائل البريد الإلكتروني ، فهل من الأفضل؟ ستقدم هذه المقالة حلين لتنزيل المرفقات تلقائيًا من Outlook إلى مجلد معين.
  • تغيير موقع حفظ المرفق الافتراضي في Outlook
  • هل سئمت من العثور على موقع المرفق الذي حددته في كل مرة عند تشغيل Outlook؟ في هذا البرنامج التعليمي ، سنوضح لك كيفية تغيير موقع المرفق الافتراضي. بعد ذلك ، سيتم فتح مجلد حفظ المرفق المحدد تلقائيًا في كل مرة تقوم فيها بحفظ المرفقات على الرغم من إعادة تشغيل Outlook.
  • إزالة كافة المرفقات من البريد الإلكتروني في Outlook
  • عادةً، عندما تقوم بمعاينة رسالة بريد إلكتروني، يمكنك حذف مرفق بالنقر بزر الماوس الأيمن وتحديد عنصر إزالة المرفق. في بعض الأحيان، قد يكون هناك العديد من المرفقات في رسالة البريد الإلكتروني، وسيكون من الصعب إزالتها واحدًا تلو الآخر. نرتب لك هنا حيلتين سهلتين لإزالة جميع المرفقات في بريد إلكتروني واحد، وإزالة جميع المرفقات من رسائل بريد إلكتروني متعددة أيضًا في Outlook.

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

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

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

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

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

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

؟؟؟؟ واجهة ماجيك: 😊 المزيد من الرموز التعبيرية الجميلة والرائعة   /  عزز إنتاجية Outlook الخاص بك باستخدام طرق العرض المبوبة  /  تصغير Outlook بدلاً من الإغلاق 

؟؟؟؟ بنقرة واحدة عجائب: الرد على الكل بالمرفقات الواردة  /   رسائل البريد الإلكتروني لمكافحة التصيد  /  🕘إظهار المنطقة الزمنية للمرسل 

👩🏼‍🤝‍👩🏻 جهات الاتصال والتقويم: دفعة إضافة جهات الاتصال من رسائل البريد الإلكتروني المحددة  /  تقسيم مجموعة اتصال إلى مجموعات فردية  /  إزالة تذكير عيد ميلاد 

على مدى ميزات 100 في انتظار الاستكشاف الخاص بك! انقر هنا لاكتشاف المزيد.

 

 

Comments (12)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Why am I getting "user-defined type not defined" when I get to Step 8?
This comment was minimized by the moderator on the site
Why am I getting "user-defined type not defined" when I get to Step 8?
This comment was minimized by the moderator on the site
When I do this, it always put the attachments at the beginning of the message, no matter where my cursor is located. I then have to copy/paste to the bottom of the email. Is there a way to change that?
This comment was minimized by the moderator on the site
Hello, VMS,
If you want to put the attachments at the the position of your cursor, please replace the second code with following code:

Public Sub AddAttachmentNamesToBody()

Dim xMailItem As MailItem

Dim xAttachment As Attachment

Dim xFileName As String

Dim xInspector As Outlook.Inspector

Dim xDoc As Word.Document

Dim xWdSelection As Word.Selection

On Error Resume Next

Set xMailItem = Outlook.ActiveInspector.CurrentItem

If xMailItem.Attachments.Count = 0 Then

Exit Sub

End If

xFileName = ""

For Each xAttachment In xMailItem.Attachments

If xFileName = "" Then

xFileName = " <" & xAttachment.FileName & "> "

Else

xFileName = xFileName & vbCrLf & " <" & xAttachment.FileName & "> "

End If

Next xAttachment

Set xInspector = Outlook.Application.ActiveInspector()

Set xDoc = xInspector.WordEditor

Set xWdSelection = xDoc.Application.Selection

xWdSelection.InsertBefore "Attachments: " & vbCrLf & xFileName & vbCrLf & vbCrLf

Set xMailItem = Nothing

End Sub

Please try, hope it can help you!
This comment was minimized by the moderator on the site
That worked! Now another favor... How do I exclude certain file types or names? My required company signature contains a PNG file that I would like to exclude.Thank you!!
This comment was minimized by the moderator on the site
To exclude some specific files, please apply the below code, please try it.
Public Sub AddAttachmentNamesToBody()

Dim xMailItem As MailItem

Dim xAttachment As Attachment

Dim xFileName As String

Dim xInspector As Outlook.Inspector

Dim xDoc As Word.Document

Dim xWdSelection As Word.Selection

Dim xExt As String

Dim xFound As Boolean

Dim xExtArr As Variant

On Error Resume Next

xExtArr = Array("docx", "exe") 'change the file extension you want to exclude

Set xMailItem = Outlook.ActiveInspector.CurrentItem

If xMailItem.Attachments.Count = 0 Then

Exit Sub

End If

xFileName = ""

For Each xAttachment In xMailItem.Attachments

xExt = VBA.Mid(xAttachment.FileName, VBA.InStrRev(xAttachment.FileName, ".") + 1)

xFound = False

For i = LBound(xExtArr) To UBound(xExtArr)

If xExt = xExtArr(i) Then

xFound = True

Exit For

End If

Next

If xFound = False Then

If xFileName = "" Then

xFileName = " <" & xAttachment.FileName & "> "

Else

xFileName = xFileName & vbCrLf & " <" & xAttachment.FileName & "> "

End If

End If

Next xAttachment

Set xInspector = Outlook.Application.ActiveInspector()

Set xDoc = xInspector.WordEditor

Set xWdSelection = xDoc.Application.Selection

xWdSelection.InsertBefore "Attachments: " & vbCrLf & xFileName & vbCrLf & vbCrLf

Set xMailItem = Nothing

End Sub
This comment was minimized by the moderator on the site
when I tried this code it sends the attachment names in every email that has attachments.
I want it to only do it when I click the macro.

How do I amend the code to do just that?
This comment was minimized by the moderator on the site
I also don't know how to fix it. Anyone could hep on that?
This comment was minimized by the moderator on the site
This is wonderful -- thank you! Is there also a way to somehow view all the attachment names in an email that has been sent to you from someone else (i.e. received)? For some reason, the file names are not displaying in full unless you hover, which is ridiculous when you regularly have 15 files to sort through.
This comment was minimized by the moderator on the site
Hello,
To List all attachment names in an received email, please copy and pase the below VBA code into the ThisOutlookSession module of the Microsoft Visual Basic for Applications window:

Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim xEIDArr As Variant, xEID As Variant, xItem As Object
Dim xAttachment As Attachment
Dim xFileName As String
On Error Resume Next
xEIDArr = Split(EntryIDCollection, ",")
For Each xEID In xEIDArr
Set xItem = Session.GetItemFromID(xEID)
If xItem.Class = olMail Then
xFileName = ""
For Each xAttachment In xItem.Attachments
If IsEmbeddedAttachment(xAttachment) = False Then
If xFileName = "" Then
xFileName = " " & "<" & xAttachment.FileName & ">"
Else
xFileName = xFileName & "
" & " " & "<" & xAttachment.FileName & ">"
End If
End If
Next xAttachment
If xFileName = "" Then Exit Sub
xFileName = "Attachments: " & "
" & xFileName & "
" & "
"
xItem.HTMLBody = "" & xFileName & "" & xItem.HTMLBody
xItem.Save
End If
Next
Set xItem = Nothing
End Sub

Function IsEmbeddedAttachment(Attach As Attachment)
Dim xAttParent As Object
Dim xCID As String, xID As String
Dim xHTML As String
On Error Resume Next
Set xAttParent = Attach.Parent
xCID = ""
xCID = Attach.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F")
If xCID <> "" Then
xHTML = xAttParent.HTMLBody
xID = "cid:" & xCID
If InStr(xHTML, xID) > 0 Then
IsEmbeddedAttachment = True
Else
IsEmbeddedAttachment = False
End If
End If
End Function

After pasting this code, when new emails with attachments arriving in your Outlook, the attachment names will be listed at the top of the message body automatically.
Please try it, hope it can help you!
This comment was minimized by the moderator on the site
this is great. Is there any way to merge this with VMS's request above to exclude some specific files included in signatures (.png, .jpg, etc.)?
This comment was minimized by the moderator on the site
Great, thanks for that. I wonder if it is possible that the list of attachments is only attached when I write to a specific email address?
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations