메인 컨텐츠로 가기

Outlook에서 전자 메일을 작성할 때 모든 첨부 파일 이름을 메시지 본문에 나열하는 방법은 무엇입니까?

Outlook에서 이메일을 작성할 때 모든 첨부 파일 이름을 메시지 본문에 삽입하는 좋은 방법이 있습니까? 이 기사에서는 Outlook 에서이 작업을 해결하는 방법에 대해 설명합니다.

VBA 코드로 이메일을 작성할 때 모든 첨부 파일 이름을 메시지 본문에 나열

간단한 기능으로 이메일을 작성할 때 모든 첨부 파일 이름을 메시지 본문에 나열


VBA 코드로 이메일을 작성할 때 모든 첨부 파일 이름을 메시지 본문에 나열

이 작업을 완료하려면 다음 단계를 수행하십시오.

1. 누르고 ALT + F11 키를 눌러 응용 프로그램 용 Microsoft Visual Basic 창.

2. 에서 응용 프로그램 용 Microsoft Visual Basic 창, 더블 클릭 ThisOutlook세션 인사말 프로젝트 1 (VbaProject.OTM) 창을 열어 모드를 연 다음 다음 코드를 복사하여 빈 모듈에 붙여 넣습니다.

VBA 코드 : 모든 첨부 파일 이름을 메시지 본문에 나열합니다.

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. 그런 다음 클릭하십시오. 끼워 넣다 > 모듈, 아래 코드를 복사하여 열린 빈 모듈에 붙여 넣으십시오. 스크린 샷을 참조하십시오.

VBA 코드 : 모든 첨부 파일 이름을 메시지 본문에 나열합니다.

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. 그런 다음 도구 > 참고자료 FBI 증오 범죄 보고서 응용 프로그램 용 Microsoft Visual Basic 창, 튀어 나온 참조 -Project1 대화 상자, 확인 Microsoft Word 개체 라이브러리 옵션에서 사용 가능한 참조 목록 상자, 스크린 샷 참조 :

5. 딸깍 하는 소리 OK 대화 상자를 종료하려면 매크로 버튼을 빠른 액세스 도구 모음. 새로운 보내실 내용 창, 선택 더 많은 명령 인사말 신속 접근 도구 막대 사용자 화 드롭 다운, 스크린 샷 참조 :

6. 에서 전망 옵션 대화 상자에서 다음 작업을 수행하십시오.

(1.) 선택 매크로 인사말 에서 명령 선택 드롭 다운 목록;

(2.) 방금 삽입한 매크로 이름을 클릭합니다.

(3.) 그런 다음 추가 버튼을 눌러 매크로를 신속 접근 도구 막대 사용자 화.

7. 그런 다음 OK 대화 상자를 닫으려면 이제 매크로 버튼이 빠른 액세스 도구 모음, 스크린 샷 참조 :

8. 이제 새 메시지를 작성하고 매크로 버튼을 클릭하면 표시된 다음 스크린샷과 같이 첨부 파일 이름이 메시지 본문 위에 삽입됩니다.


간단한 기능으로 이메일을 작성할 때 모든 첨부 파일 이름을 메시지 본문에 나열

위의 코드는 적용하기가 다소 어려울 수 있습니다. Outlook 용 Kutools그와 이름 복사 기능을 사용하면 메시지의 첨부 파일 이름을 빠르게 복사하여 필요한 곳에 붙여 넣을 수 있습니다.

참고 :이것을 적용하려면 이름 복사, 먼저 Outlook 용 Kutools을 클릭 한 다음 기능을 빠르고 쉽게 적용하십시오.

설치 후 Outlook 용 Kutools, 다음과 같이하십시오.

1. 먼저 필요한 새 이메일을 생성한 후 다음을 클릭하세요. 쿠툴 > 이름 복사 새로운 보내실 내용 창, 스크린 샷 참조 :

2. 그런 다음 첨부 파일 이름이 클립보드에 복사되었음을 알리는 프롬프트 상자가 나타납니다. 스크린샷을 참조하세요.

3. 이제 누르기만 하면 된다 Ctrl + V 키를 함께 사용하여 첨부 파일 이름을 필요한 메시지 본문에 붙여 넣으세요. 스크린샷을 참조하세요.


더 많은 관련 기사 :

  • Outlook의 원본 첨부 파일을 포함하여 전체 회신
  • 일반적으로 전체 회신 기능을 적용하여 Outlook의 모든 수신자에게 메시지를 회신하면 원본 첨부 파일이 자동으로 손실됩니다. Outlook에서 모두 회신 할 때 원본 첨부 파일을 첨부 할 수 있습니까?
  • Outlook의 첨부 파일을 특정 폴더로 다운로드/저장
  • 일반적으로 Outlook에서 첨부 파일> 모든 첨부 파일 저장을 클릭하여 한 전자 메일의 모든 첨부 파일을 저장할 수 있습니다. 그러나 수신 된 모든 이메일 및 수신 이메일의 모든 첨부 파일을 저장해야하는 경우 이상적인 것은 무엇입니까? 이 기사에서는 Outlook에서 특정 폴더로 첨부 파일을 자동으로 다운로드하는 두 가지 솔루션을 소개합니다.
  • Outlook에서 기본 첨부 파일 저장 위치 변경
  • Outlook을 시작할 때마다 지정한 첨부 파일 위치를 찾는 데 지쳤습니까? 이 튜토리얼에서는 기본 첨부 위치를 변경하는 방법을 보여줍니다. 그 후에는 Outlook을 다시 시작하더라도 첨부 파일을 저장할 때마다 지정된 첨부 파일 저장 폴더가 자동으로 열립니다.
  • Outlook의 이메일에서 모든 첨부 파일 제거
  • 일반적으로 이메일을 미리 볼 때 마우스 오른쪽 버튼을 클릭하고 첨부 파일 제거 항목을 선택하여 첨부 파일을 삭제할 수 있습니다. 때로는 이메일 메시지에 첨부 파일이 너무 많아서 하나씩 제거하는 것이 지루할 수 있습니다. 여기서는 하나의 이메일에서 모든 첨부 파일을 제거하고 Outlook에서도 여러 이메일의 모든 첨부 파일을 제거하는 두 가지 쉬운 방법을 소개합니다.

최고의 사무 생산성 도구

Outlook 용 Kutools - 귀하의 전망을 강화하는 100개 이상의 강력한 기능

🤖 AI 메일 도우미: AI 마법이 적용된 즉각적인 전문가 이메일 - 원클릭으로 천재적인 답변, 완벽한 어조, 다국어 숙달이 가능합니다. 손쉽게 이메일을 변환하세요! ...

📧 이메일 자동화: 부재중(POP 및 IMAP에서 사용 가능)  /  이메일 보내기 예약  /  이메일 발송 시 규칙에 따른 자동 참조/숨은참조  /  자동 전달(고급 규칙)   /  인사말 자동 추가   /  여러 수신자 이메일을 개별 메시지로 자동 분할 ...

📨 이메일 관리: 이메일을 쉽게 기억할 수 있습니다.  /  제목 및 기타 사기 이메일 차단  /  중복 이메일 삭제  /  고급 검색  /  폴더 통합 ...

📁 첨부 파일 프로일괄 저장  /  일괄 분리  /  일괄 압축  /  자동 저장   /  자동 분리  /  자동 압축 ...

🌟 인터페이스 매직: 😊더 예쁘고 멋진 이모티콘   /  탭 보기로 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