메인 컨텐츠로 가기

Outlook에서 첨부 파일 이름으로 이메일 제목을 자동으로 채우는 방법은 무엇입니까?

Outlook에서 전자 메일의 제목으로 첨부 파일 이름을 사용하는 데 익숙한 사용자의 경우 매번 제목 줄에 첨부 파일 이름을 수동으로 입력하는 것은 시간 소모적입니다. 아래 gif와 같이 첨부 파일을 삽입할 때 이메일 제목 줄에 첨부 파일 이름을 자동으로 채우고 싶다면 이 튜토리얼의 VBA 방법이 도움이 될 것입니다.


전자 메일 제목을 VBA 코드로 첨부 파일 이름으로 자동 채우기

Outlook에 삽입된 첨부 파일의 이름으로 이메일 제목을 자동으로 채우려면 다음 VBA 코드를 실행하십시오.

1. Outlook을 시작하고 다른 + F11 키를 눌러 응용 프로그램 용 Microsoft Visual Basic 창.

2. 에서 응용 프로그램 용 Microsoft Visual Basic 창, 더블 클릭 프로젝트1(VbProject.OTM) > Microsoft Outlook 개체 > ThisOutlook세션 를 열려면 ThisOutlookSession (코드) 편집기.

3. 그런 다음 다음 VBA 코드를 복사하십시오. ThisOutlookSession (코드) 편집기.

VBA 코드: 첨부 파일 이름으로 이메일 제목 자동 채우기

Public WithEvents GExplorer As Explorer
'Updated by Extendoffice 20220926
Public WithEvents GInspectors As Inspectors
Public WithEvents GMail As MailItem

Private Sub Application_Startup()
  Set GExplorer = Application.ActiveExplorer
  Set GInspectors = Application.Inspectors
End Sub

Private Sub GExplorer_InlineResponse(ByVal Item As Object)
  Set GMail = Item
End Sub

Private Sub GInspectors_NewInspector(ByVal Inspector As Inspector)
  Dim xItem As Object
  Set xItem = Inspector.CurrentItem
  If xItem.Class <> olMail Then Exit Sub
  Set GMail = xItem
End Sub

Private Sub GMail_AttachmentAdd(ByVal Att As Attachment)
  Dim xFileName As String
  On Error Resume Next
  If VBA.Trim(GMail.Subject) <> "" Then Exit Sub
  If MsgBox("Do you want to use the attachment name as the subject?", vbYesNo + vbInformation, "Kutools for Outlook") = vbNo Then Exit Sub
  xFileName = Att.DisplayName
  xFileName = Left$(xFileName, VBA.InStrRev(xFileName, ".") - 1)
  GMail.Subject = xFileName
End Sub

4. 이제 코드를 저장하고 Outlook을 다시 시작해야 합니다.

5. 이제부터 아직 제목이 채워지지 않은 이메일에 첨부파일을 넣으면 Outlook 용 Kutools 첨부 파일 이름을 제목으로 사용할 것인지 묻는 대화 상자가 나타나면 가능 버튼을 클릭합니다.

그러면 제목 줄에 삽입된 첨부 파일의 이름이 자동으로 채워집니다.

노트:

1) 이미 제목을 입력하셨다면 첨부파일을 넣어도 대화상자가 뜨지 않습니다.
2) 현재 이메일에서 기존 제목을 제거했지만 커서가 여전히 제목 줄에 표시되어 있는 경우 첨부 파일을 삽입해도 대화 상자가 나타나지 않습니다. 제목을 제거한 후 코드가 작동하도록 하려면 제목 줄에서 멀리 클릭하여 메시지 상자를 새로 고쳐야 합니다.
3) 여러 개의 첨부파일을 동시에 삽입할 경우 첫 번째 첨부파일의 이름만 이메일 제목으로 사용할 수 있습니다.

최고의 사무 생산성 도구

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

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

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

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

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

🌟 인터페이스 매직: 😊더 예쁘고 멋진 이모티콘   /  탭 보기로 Outlook 생산성 향상  /  문을 닫는 대신 전망을 최소화하세요 ...

???? 원클릭 불가사의: 수신 첨부 파일과 함께 전체 회신  /   피싱 방지 이메일  /  🕘발신자의 시간대 표시 ...

👩🏼‍🤝‍👩🏻 연락처 및 캘린더: 선택한 이메일에서 연락처 일괄 추가  /  연락처 그룹을 개별 그룹으로 분할  /  생일 알림 제거 ...

이상 100 특징 당신의 탐험을 기다려주세요! 더 알아보려면 여기를 클릭하세요.

 

 

Comments (11)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Everything works now. Thanks very much.
This comment was minimized by the moderator on the site
I'm glad I could help you.
This comment was minimized by the moderator on the site
Hello,
I pasted your code. Outlook 365 restarted. I've tried several times, but it doesn't work. The subject line remains empty. What could be the problem?
This comment was minimized by the moderator on the site
Hi Karol,

Please check if the corresponding Macro settings are enabled in your Outlook.
Go to File > Options. In the Outlook Options window, select Trust Center in the left pane. In the Trust Center window, select Macro Settings in the left pane, and then select the Enable all macros option in the Macro Settings section and check the Apply macro security settings to installed add-ins box in the Add-ins section.
https://www.extendoffice.com/images/stories/comments/comment-picture-zxm/subject-auto.png
This comment was minimized by the moderator on the site
Добрый день. ДА при добавлении 2 файлов в тему писалось через И.
This comment was minimized by the moderator on the site
Hi Александр,

The following VBA code can help to solve your problem. Please give it a try.
Public WithEvents GExplorer As Explorer
'Updated by Extendoffice 20220131
Public WithEvents GInspectors As Inspectors
Public WithEvents GMail As MailItem
Dim GFileName As String

Private Sub Application_Startup()
  Set GExplorer = Application.ActiveExplorer
  Set GInspectors = Application.Inspectors
End Sub

Private Sub GExplorer_InlineResponse(ByVal Item As Object)
  Set GMail = Item
  GFileName = ""
End Sub

Private Sub GInspectors_NewInspector(ByVal Inspector As Inspector)
  Dim xItem As Object
  Set xItem = Inspector.CurrentItem
  If xItem.Class <> olMail Then Exit Sub
  Set GMail = xItem
  GFileName = ""
End Sub

Private Sub GMail_AttachmentAdd(ByVal Att As Attachment)
  If GMail.Subject = "" Then
    GMail.Subject = GFileName
  Else
    GMail.Subject = GMail.Subject & " AND " & GFileName
  End If
  GFileName = ""
End Sub

Private Sub GMail_BeforeAttachmentAdd(ByVal Attachment As Attachment, Cancel As Boolean)
  On Error Resume Next
  GFileName = Attachment.DisplayName
  GFileName = Left$(GFileName, VBA.InStrRev(GFileName, ".") - 1)
  If VBA.Trim(GMail.Subject) <> "" Then Exit Sub
  If MsgBox("Do you want to use the attachment name as the subject?", vbYesNo + vbInformation, "Kutools for Outlook") = vbNo Then
    GFileName = ""
    Exit Sub
  End If
End Sub
This comment was minimized by the moderator on the site
Да получилось. Огромное спасибо за помощь. И еще один вопрос, а можно в конце всего этого, при нажатии кнопки "Отправить" выдавал некое сообщение что то типа "Вы действительно хотите отправить данное сообщение"?
This comment was minimized by the moderator on the site
Да, именно. ТЕ при добавлении или перетягивании двух файлов тема письма автоматом писалась через И
This comment was minimized by the moderator on the site
Добрый день. Подскажите пожалуйста можно ли сделать что бы тема формировалась из 2 и более файлов с разделение И? Может в данном коде дописать или вообще другой существует? Заранее спасибо
This comment was minimized by the moderator on the site
Hi Александр,

Do you mean adding multiple attachments while adding those attachment names at the same time to the subject and then linking them with AND?
This comment was minimized by the moderator on the site
Да. Например перетащил два файла и он их имена написал через И. Именно два файла, больше не надо.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations