메인 컨텐츠로 가기

Excel에서 통합 문서가 업데이트 된 경우 이메일 알림 또는 알림을 보내는 방법은 무엇입니까?

경우에 따라 보낸 통합 문서에 업데이트 된 데이터가있는 경우 지정된받는 사람에게 전자 메일 알림을 트리거해야 할 수 있습니다. 이 기사는 그것을 달성하는 방법을 보여줄 것입니다.

통합 문서가 VBA 코드로 업데이트 된 경우 이메일 알림 또는 알림 보내기


통합 문서가 VBA 코드로 업데이트 된 경우 이메일 알림 또는 알림 보내기

통합 문서가 업데이트 된 경우 이메일 알림 또는 알림을 보내려면 다음과 같이하십시오.

1. 통합 문서에서 업데이트 된 데이터를 기반으로 이메일 알림을 보낼 지정된 워크 시트를 엽니 다.

2. 시트 탭을 마우스 오른쪽 버튼으로 클릭하고 코드보기 오른쪽 클릭 메뉴에서. 스크린 샷보기 :

2. 에서 응용 프로그램 용 Microsoft Visual Basic 창에서 다음 코드를 복사하여 코드 창에 붙여 넣습니다. 스크린 샷보기 :

VBA 코드 : 통합 문서가 업데이트 된 경우 전자 메일 알림 또는 알림 보내기

Private Sub Worksheet_Change(ByVal Target As Range)
'Updated by Extendoffice 2017/9/14
    Dim xOutApp As Object
    Dim xMailItem As Object
    Dim xName As String
    Dim xYesOrNo As Integer
    On Error Resume Next
    Set xOutApp = CreateObject("Outlook.Application")
    Set xMailItem = xOutApp.CreateItem(0)
    xYesOrNo = MsgBox("Want to attach updated workbook in email?", vbInformation + vbYesNo, "KuTools For Excel")
    If xYesOrNo = 6 Then ActiveWorkbook.Save
    If xYesOrNo = 6 Then xName = ActiveWorkbook.FullName
    With xMailItem
        .To = "Email Address"
        .cc = ""
        .Subject = "email notification test"
        .Body = "Hi," & Chr(13) & Chr(13) & "File is now updated."
        If xYesOrNo = 6 Then .Attachments.Add xName
        .Display
    End With
    xMailItem = Nothing
    xOutApp = Nothing
End Sub

주의 사항: 이메일 주소를 수신자 이메일 주소로 바꿉니다. .To = "이메일 주소". 그리고 필요에 따라 VBA 코드에서 Cc, Subject 및 본문 필드를 변경하십시오.

3. 누르세요 다른 + Q 닫는 키 응용 프로그램 용 Microsoft Visual Basic 창.

4. 워크 시트에서 셀을 편집 한 후 Excel 용 Kutools 아래 스크린 샷과 같이 대화 상자가 나타납니다. 업데이트 된 통합 문서를 이메일에 첨부하려면 가능 단추. 그렇지 않은 경우 아니 버튼을 클릭합니다.

5. 업데이트 된 통합 문서가 첨부되거나 첨부되지 않은 상태로 전자 메일이 자동으로 생성됩니다. 그리고 지정된 모든 필드도 이메일에 나열됩니다. 클릭하십시오 전송 버튼을 눌러 보내십시오.

주의 사항: VBA 코드는 Outlook을 전자 메일 프로그램으로 사용할 때만 작동합니다.


관련 기사 :

최고의 사무 생산성 도구

🤖 Kutools AI 보좌관: 다음을 기반으로 데이터 분석을 혁신합니다. 지능형 실행   |  코드 생성  |  사용자 정의 수식 만들기  |  데이터 분석 및 차트 생성  |  Kutools 기능 호출...
인기 기능: 중복 항목 찾기, 강조 표시 또는 식별   |  빈 행 삭제   |  데이터 손실 없이 열이나 셀 결합   |   수식없이 반올림 ...
슈퍼 조회: 다중 기준 VLookup    다중 값 VLookup  |   여러 시트에 걸친 VLookup   |   퍼지 조회 ....
고급 드롭다운 목록: 드롭다운 목록을 빠르게 생성   |  종속 드롭다운 목록   |  다중 선택 드롭 다운 목록 ....
열 관리자: 특정 개수의 열 추가  |  열 이동  |  Toggle 숨겨진 열의 가시성 상태  |  범위 및 열 비교 ...
특색 지어진 특징: 그리드 포커스   |  디자인보기   |   큰 수식 바    통합 문서 및 시트 관리자   |  리소스 라이브러리 (자동 텍스트)   |  날짜 선택기   |  워크 시트 결합   |  셀 암호화/해독    목록으로 이메일 보내기   |  슈퍼 필터   |   특수 필터 (굵게/기울임꼴/취소선 필터링...) ...
상위 15개 도구 세트12 본문 도구 (텍스트 추가, 문자 제거,...)   |   50+ 거래차트 유형 (Gantt 차트,...)   |   40+ 실용 방식 (생일을 기준으로 나이 계산,...)   |   19 삽입 도구 (QR 코드 삽입, 경로에서 그림 삽입,...)   |   12 매출 상승 도구 (숫자를 단어로, 환율,...)   |   7 병합 및 분할 도구 (고급 결합 행, 셀 분할,...)   |   ... 그리고 더

Excel용 Kutools로 Excel 기술을 강화하고 이전과는 전혀 다른 효율성을 경험해 보세요. Excel용 Kutools는 생산성을 높이고 시간을 절약하기 위해 300개 이상의 고급 기능을 제공합니다.  가장 필요한 기능을 얻으려면 여기를 클릭하십시오...

상품 설명


Office Tab은 Office에 탭 인터페이스를 제공하여 작업을 훨씬 쉽게 만듭니다.

  • Word, Excel, PowerPoint에서 탭 편집 및 읽기 사용, Publisher, Access, Visio 및 Project.
  • 새 창이 아닌 동일한 창의 새 탭에서 여러 문서를 열고 만듭니다.
  • 생산성을 50% 높이고 매일 수백 번의 마우스 클릭을 줄입니다!
Comments (20)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I am following certificates log in excel sheet. i need to get reminder before the certificates getting expired. please advice me.
This comment was minimized by the moderator on the site
Hi rahul rajan,

Do you want to pop up a reminder based on the date of a cell?
This comment was minimized by the moderator on the site
Hi which part of the code should i delete so it only sends email when i click save and not on every action ?
This comment was minimized by the moderator on the site
Hi donkeh,
In the VBA code, please replace the following line:
.Display
with
.Send
This comment was minimized by the moderator on the site
HOLA CRISTAL, ME GUSTARIA PONERME EN CONTACTO DIRECTO CONTIGO, PARA PEDIR TU AYUDA EN UN PROBLEMITA EN UNA HOJA DE EXCEL
This comment was minimized by the moderator on the site
Hi GERARDO MARTIN OLVERA,
You can email me at .
This comment was minimized by the moderator on the site
HOLA CRISTAL, ME GUSTARIA PONERME EN CONTACTO DIRECTO CONTIGO, NE CESITO DE TU AYUDA EN EXCEL,GRACIAS
This comment was minimized by the moderator on the site
please i am a bit confused but where in the code does it detect the sheet being modified/updated?
i am trying to write a code where the table on a particular sheet gets sent when the table is modified (or more specifically when rows are added)
thank you!
This comment was minimized by the moderator on the site
Hi,
The code in the post detects all cells in the entire worksheet based on the first line of "Private Sub Worksheet_Change(ByVal Target As Range)".
If you want to send an email with a particular table when it is modified, you can try the following VBA.
Note: please change "Table1" to your own table name.
Private Sub Worksheet_Change(ByVal Target As Range)
'Updated by Extendoffice 2022/5/27
    Dim xYesOrNo As Integer
    Dim xTableName As String
    Dim xTableRg As Range
    Dim I, J As Long
    Dim xEmailBody As String
    Dim xMailOut As Object
    Dim xOutApp As Object
    On Error Resume Next
    
    xTableName = "Table1" 'The name of the table you will send when it is modified
    Set xTableRg = ActiveSheet.ListObjects(xTableName).Range
    If Intersect(Target, xTableRg) Is Nothing Then Exit Sub

    Set xOutApp = CreateObject("Outlook.Application")
    Set xMailOut = xOutApp.CreateItem(olMailItem)
    For I = 1 To xTableRg.Rows.Count
        For J = 1 To xTableRg.Columns.Count
            xEmailBody = xEmailBody & "  " & xTableRg.Cells(I, J).Value
        Next
        xEmailBody = xEmailBody & vbNewLine
    Next
    xEmailBody = "Hi" & vbLf & vbLf & " body of message you want to add" & vbLf & vbLf & xEmailBody & vbNewLine
    With xMailOut
        .Subject = "Test"
        .To = ""
        .Body = xEmailBody
        .Display
        '.Send
    End With
    Set xMailOut = Nothing
    Set xOutApp = Nothing
End Sub
This comment was minimized by the moderator on the site
Hola cristal, donde dice Private Sub Worksheet_Change, deberia poner el nombre de mi excel o no?
Los rangos de (I,J) cambiarlos por los valores de celdas que yo dese estar mirando si cambian?
This comment was minimized by the moderator on the site
For me the code runs again and again, its like never ending loop. I close email it asks again to send it...
This comment was minimized by the moderator on the site
When I tried to change something in a cell a message prompted for Outlook email configuration and it just keeps on asking for my password.
This comment was minimized by the moderator on the site
Hi MJ,
Which Excel version are you using? Can you provide a screenshot of the prompt?
This comment was minimized by the moderator on the site
Sorry, I posted this in the wrong article. I will post in the correct article
This comment was minimized by the moderator on the site
Hello there, The code works great. However, when a cell changes to below the threshold point via a macro operation that copies and pastes the lower value into the designated cell, the code doesn't seem to trigger.

Also, I would like to apply this code to several cells. Can I copy and paste the code several times and change each copied version to fit each cells' needs? Is there a better way to do that. I can't figure that out. Thank you!
This comment was minimized by the moderator on the site
I copied and pasted the code exactly as-is from this page, but when I make a change to my document I get the message "Syntax Error" and this line highlights: Dim xOutApp As Object. Any help would be appreciated.
This comment was minimized by the moderator on the site
Hi Judy,
Would you provide the Excel version you are using? Thank you for your comment.
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