Ugrás a tartalomra

Hogyan hozzuk létre automatikusan a kedves küldő nevét, amikor az Outlookra válaszolunk?

E-mail válaszakor kézzel kell beírnia a feladó nevét és üdvözletét. Időmegtakarítás és a munka hatékonyságának növelése érdekében érdemes megfontolnia egy kedves küldő nevének és üdvözletének automatikus létrehozását az Outlook programban. Ebben a cikkben néhány hasznos módszerről fogok beszélni a feladat megoldására az Outlook programban.

Hozzon létre egy kedves feladó nevét és üdvözletét automatikusan, amikor VBA kóddal válaszol az üzenetre

Hozzon létre egy kedves feladó nevét és üdvözli automatikusan, amikor a Kutools for Outlook alkalmazással válaszol üzenetre


Hozzon létre egy kedves feladó nevét és üdvözletét automatikusan, amikor VBA kóddal válaszol az üzenetre

A következő VBA-kód segíthet egy kedves küldő nevének és üdvözletének automatikus beillesztésében, amikor válaszol egy e-mailre, kérjük, tegye a következőket:

1. Tartsa lenyomva a ALT + F11 billentyűk megnyitásához Microsoft Visual Basic for Applications ablak.

2. Az Microsoft Visual Basic for Applications ablakban kattintson duplán ThisOutlookSession tól Project1 (VbaProject.OTM) ablaktáblán nyissa meg a módot, majd másolja és illessze be a következő kódot az üres modulba.

VBA kód: Válaszkor automatikusan illessze be a kedves küldő nevét és üdvözletét:

Public WithEvents GExplorer As Outlook.Explorer
Public WithEvents GMailItem As Outlook.MailItem
Private Sub Application_Startup()
    Set GExplorer = Outlook.Application.ActiveExplorer
End Sub
Private Sub GExplorer_SelectionChange()
    Dim xItem As Object
    On Error Resume Next
    Set xItem = GExplorer.Selection.Item(1)
    If xItem.Class <> olMail Then Exit Sub
    Set GMailItem = xItem
End Sub
Private Sub GMailItem_Reply(ByVal Response As Object, Cancel As Boolean)
    AutoAddGreetingToReply Response
End Sub
Private Sub GMailItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
    AutoAddGreetingToReply Response
End Sub
Sub AutoAddGreetingToReply(Item As Object)
    Dim xGreetStr As String
    Dim xReplyMail As MailItem
    Dim xSenderName As String
    Dim xRecipient As Recipient
    On Error Resume Next
    If Item.Class <> olMail Then Exit Sub
    Set xReplyMail = Item
    For Each xRecipient In xReplyMail.Recipients
        If xSenderName = "" Then
            xSenderName = xRecipient.Name
        Else
            xSenderName = xSenderName & "," & xRecipient.Name
        End If
    Next xRecipient
    Select Case Time
           Case 0.3 To 0.5
                xGreetStr = " Good morning!"
           Case 0.5 To 0.75
                xGreetStr = " Good afternoon!"
           Case Else
                xGreetStr = " Good evening!"
    End Select
    With xReplyMail
        .Display
        .HTMLBody = "<HTML><Body>Dear " & xSenderName & ",</HTML></Body>" & xGreetStr & .HTMLBody
    End With
End Sub

doc auto kedves küldő neve 1

3. Ezután zárja be az Outlook programot, és indítsa újra a kódhatás eléréséhez, és most, amikor válaszol egy e-mailre, egy kedves küldő neve és üdvözlete automatikusan beillesztésre kerül a törzsbe, lásd a képernyőképet:

doc auto kedves küldő neve 2


Hozzon létre egy kedves feladó nevét és üdvözli automatikusan, amikor a Kutools for Outlook alkalmazással válaszol üzenetre

Ha van Kutools az Outlook számára, Annak Üdvözlet hozzáadása válaszkor funkció, az Outlook válaszadáskor automatikusan beszúrja a feladó nevét.

Kutools az Outlook számára : több mint 100 praktikus Outlook-bővítménnyel, 60 nap alatt szabadon kipróbálható korlátozás nélkül. 

Telepítése után Kutools az Outlook számára, kérlek tedd így!

1. Kattints Kutools > Opciók, lásd a képernyőképet:

doc auto kedves küldő neve 3

2. Az Opciók párbeszédpanel alatt Válasz fül, csekk Üdvözlet hozzáadása válaszkor lehetőséget, majd írja be az üdvözletet, amire szüksége van, lásd a képernyőképet:

doc auto kedves küldő neve 4

3. Ezután kattintson OK ennek a beállításnak a befejezéséhez ezentúl egy üzenet megválaszolásakor az üdvözlet automatikusan létrejön az üzenet törzse előtt, lásd a képernyőképet:

doc auto kedves küldő neve 5

Kattintson a Kutools for Outlook letöltéséhez és az ingyenes próbaverzióhoz most!


A legjobb irodai hatékonyságnövelő eszközök

Kutools az Outlook számára - Több mint 100 hatékony funkció az Outlook feltöltéséhez

🤖 AI Mail Assistant: Azonnali profi e-mailek mesterséges intelligencia varázslattal – egyetlen kattintással zseniális válaszok, tökéletes hangnem, többnyelvű elsajátítás. Alakítsa át az e-mailezést könnyedén! ...

???? E-mail automatizálás: Hivatalon kívül (POP és IMAP esetén elérhető)  /  Ütemezze az e-mailek küldését  /  Automatikus CC/BCC szabályok szerint e-mail küldésekor  /  Automatikus továbbítás (Speciális szabályok)   /  Automatikus üdvözlet hozzáadása   /  A több címzettnek szóló e-mailek automatikus felosztása egyedi üzenetekre ...

📨 Email Management: Könnyen visszahívhatja az e-maileket  /  Blokkolja az alanyok és mások átverő e-mailjeit  /  Törölje az ismétlődő e-maileket  /  Részletes keresés  /  Mappák összevonása ...

📁 Attachments ProKötegelt mentés  /  Batch Detach  /  Batch tömörítés  /  Automatikus mentés   /  Automatikus leválasztás  /  Automatikus tömörítés ...

🌟 Interface Magic: 😊További szép és menő hangulatjelek   /  Növelje Outlook termelékenységét a füles nézetekkel  /  Minimalizálja az Outlookot a bezárás helyett ...

👍 Csodák egy kattintással: Válasz mindenkinek a bejövő mellékletekkel  /   Adathalászat elleni e-mailek  /  🕘A feladó időzónájának megjelenítése ...

👩🏼‍🤝‍👩🏻 Névjegyek és naptár: Névjegyek kötegelt hozzáadása a kiválasztott e-mailekből  /  Egy kapcsolattartó csoport felosztása egyéni csoportokra  /  Távolítsa el a születésnapi emlékeztetőket ...

Több, mint 100 Jellemzők Várja felfedezését! Kattintson ide, ha többet szeretne megtudni.

 

 

Comments (12)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi skyyang,

I need the macro to insert only the first name of the person I receive the email from. Not all the names from CC, but not to remove anyone. Also, to maintain my default color scale (R: 31, G: 73, B: 125) and font size (11 pt) with an additional line after the sender name. Please help me with this. Thanks in advance
This comment was minimized by the moderator on the site
Bonjour,
Puis je avoir le code VBA pour insérer "Bonjour prénom," seulement ???

Merci de votre aide.
This comment was minimized by the moderator on the site
Hello, Nicolas
Please apply the below code:
Public WithEvents GExplorer As Outlook.Explorer
Public WithEvents GMailItem As Outlook.MailItem
Private Sub Application_Startup()
    Set GExplorer = Outlook.Application.ActiveExplorer
End Sub
Private Sub GExplorer_SelectionChange()
    Dim xItem As Object
    On Error Resume Next
    Set xItem = GExplorer.Selection.Item(1)
    If xItem.Class <> olMail Then Exit Sub
    Set GMailItem = xItem
End Sub
Private Sub GMailItem_Reply(ByVal Response As Object, Cancel As Boolean)
    AutoAddGreetingToReply Response
End Sub
Private Sub GMailItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
    AutoAddGreetingToReply Response
End Sub
Sub AutoAddGreetingToReply(Item As Object)
    Dim xReplyMail As MailItem
    Dim xSenderName As String
    Dim xRecipient As Recipient
    On Error Resume Next
    If Item.Class <> olMail Then Exit Sub
    Set xReplyMail = Item
    For Each xRecipient In xReplyMail.Recipients
        If xSenderName = "" Then
            xSenderName = xRecipient.Name
        Else
            xSenderName = xSenderName & "," & xRecipient.Name
        End If
    Next xRecipient
    With xReplyMail
        .Display
        .HTMLBody = "<HTML><Body>Dear " & xSenderName & ",</HTML></Body>" & .HTMLBody
    End With
End Sub

Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
Hi.
What do i need to edit in the VBA code to include first name only and to omit the "(s)" after Dear?
Thanks
This comment was minimized by the moderator on the site
Hello, Matt,
To solve your problem, the follwoing VBA code may do you a favor:
Public WithEvents GExplorer As Outlook.Explorer
Public WithEvents GMailItem As Outlook.MailItem
Private Sub Application_Startup()
  Set GExplorer = Outlook.Application.ActiveExplorer
End Sub
Private Sub GExplorer_SelectionChange()
  Dim xItem As Object
  On Error Resume Next
  Set xItem = GExplorer.Selection.Item(1)
  If xItem.Class <> olMail Then Exit Sub
  Set GMailItem = xItem
End Sub
Private Sub GMailItem_Reply(ByVal Response As Object, Cancel As Boolean)
  AutoAddGreetingToReply Response
End Sub
Private Sub GMailItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
  AutoAddGreetingToReply Response
End Sub
Sub AutoAddGreetingToReply(Item As Object)
  Dim xGreetStr As String
  Dim xReplyMail As MailItem
  Dim xSenderName As String
  Dim xRcpName As String
  Dim xRecipient As Recipient
  Dim xContactItem As ContactItem
  Dim xExUser As ExchangeUser
  On Error Resume Next
  If Item.Class <> olMail Then Exit Sub
  Set xReplyMail = Item
  xSenderName = ""
  xRcpName = ""
  For Each xRecipient In xReplyMail.Recipients
    Set xExUser = Nothing
    Set xContactItem = Nothing
    If xRecipient.AddressEntry.AddressEntryUserType < 6 Then
      Set xExUser = xRecipient.AddressEntry.GetExchangeUser
    Else
      Set xContactItem = xRecipient.AddressEntry.GetContact
    End If
    If Not xExUser Is Nothing Then
      If xSenderName = "" Then
        xSenderName = xExUser.FirstName
        If xSenderName = "" Then
          xSenderName = xRecipient.Name
        End If
      Else
        xSenderName = xSenderName & ", " & xExUser.FirstName
        If xExUser.FirstName = "" Then
          xSenderName = xSenderName & xRecipient.Name
        End If
      End If
    ElseIf Not xContactItem Is Nothing Then
      If xSenderName = "" Then
        xSenderName = xContactItem.FirstName
        If xSenderName = "" Then
          xSenderName = xRecipient.Name
        End If
      Else
        xSenderName = xSenderName & ", " & xContactItem.FirstName
        If xRecipient.FirstName = "" Then
          xSenderName = xSenderName & xRecipient.Name
        End If
      End If
    Else
      If xSenderName = "" Then
        xSenderName = xRecipient.Name
      Else
        xSenderName = xSenderName & ", " & xRecipient.Name
      End If
    End If
  Next xRecipient
  Select Case Time
    Case 0.3 To 0.5
      xGreetStr = " Good morning!"
    Case 0.5 To 0.75
      xGreetStr = " Good afternoon!"
    Case Else
      xGreetStr = " Good evening!"
  End Select
  With xReplyMail
    .Display
    .HTMLBody = "<HTML><Body>Dear " & xSenderName & ",</HTML></Body>" & xGreetStr & .HTMLBody
  End With
End Sub

Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
Hello
Thank you for the suggestions, although it does not work. I wish to include the first name only and to omit the "(s)" after Dear?
This comment was minimized by the moderator on the site
Hello, Matt,
The above code works well.
First, you must make sure the recipient address has been added into the Contact folder in your Outlook.
If the recipient isn't in the Contact folder, when you applying this code, the full nae will be displayed.
Thank you!
This comment was minimized by the moderator on the site
Hello

Thank you for your reply! I will add contacts to my folder. I was wondering if there is a way to always display the first name only, even without contacts within my folder. For context, I work at a large university, and would be difficult and time-consuming to find all staff members individually.
This comment was minimized by the moderator on the site
Hello, Matt,

Sorry, if you haven't added the contact to the contact folder, the code will not get the recipient's first name.
Thank you!
This comment was minimized by the moderator on the site
Hi.
What do i need to edit in the VBA code to include first name only and to omit the "(s)" after Dear?
Thanks
This comment was minimized by the moderator on the site
Dear Team,

If I have set up the above configuration however, if I am replying to an email that has multiply recipients in the To, the greeting is not defaulting. How do I achieve this?
This comment was minimized by the moderator on the site
Hello, Wesley,
Yes, as you said, if there are multiple recipients in the To field, the greeting will not be inserted by default.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations