Skip i'r prif gynnwys

 Sut i anfon neges gyfarch at gyswllt yn awtomatig os yw ei ben-blwydd heddiw yn Outlook?

Rywbryd, efallai yr hoffech chi anfon neges gyfarch yn awtomatig at y cyswllt pan fydd ei ben-blwydd heddiw yn Outlook. Bydd yn waith diflas pan fyddwch yn gwirio pen-blwydd y cyswllt fesul un ac yn anfon yr e-byst cyfarch â llaw. Yr erthygl hon, byddaf yn cyflwyno cod VBA i'w ddatrys yn gyflym ac yn hawdd.

Anfonwch neges gyfarch yn awtomatig i gyswllt yn seiliedig ar ei ben-blwydd gyda chod VBA yn Outlook


Anfonwch neges gyfarch yn awtomatig i gyswllt yn seiliedig ar ei ben-blwydd gyda chod VBA yn Outlook

I anfon neges gyfarch yn awtomatig i gyswllt os yw ei ben-blwydd heddiw, mewnosodwch god VBA yn gyntaf, yna mae angen i chi greu tasg gylchol i sbarduno'r cod.

Efallai y bydd y camau canlynol yn eich helpu chi:

1. Lansio'r Rhagolwg, ac yna dal i lawr y ALT + F11 allweddi i agor y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

2. Yn y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr, cliciwch ddwywaith SesiwnOutlook oddi wrth y Prosiect1 (VbaProject.OTM) cwarel i agor y modd, ac yna copïo a gludo'r cod canlynol i'r modiwl gwag.

Cod VBA: Auto anfon neges gyfarch i gyswllt yn seiliedig ar ben-blwydd:

Private Sub Application_Reminder(ByVal Item As Object)
Dim xTempMail As MailItem
Dim xFilePath As String
Dim xItems As Outlook.Items
Dim xItem As Object
Dim xContactItem As Outlook.ContactItem
Dim xTodayDate As String
Dim xBirthdayDate As String
Dim xGreetingMail As Outlook.MailItem
Dim xWordDoc As Word.Document
Dim xGreetings As String
Dim xBool As Boolean
xFilePath = CreateObject("shell.Application").NameSpace(5).self.Path & "\UserTemplates"
Set xFSO = CreateObject("Scripting.FileSystemObject")
If xFSO.FolderExists(xFilePath) = False Then
    MkDir xFilePath
End If
If IsFileExists(xFilePath & "\Birthday Greeting Mail.oft") = False Then
    Set xTempMail = Outlook.CreateItem(olMailItem)
    xTempMail.SaveAs xFilePath & "\Birthday Greeting Mail.oft", olTemplate
    xTempMail.Close olDiscard
End If
If (TypeOf Item Is TaskItem) And (Item.Subject = "Send Birthday Greeting Mail") Then
xGreetings = "Happy Birthday!"
           xGreetings = InputBox("Input birthday greetings", "Kutools for Outlook", xGreetings)
   xTodayDate = Month(Date) & "-" & Day(Date)
   Set xItems = Outlook.Application.Session.GetDefaultFolder(olFolderContacts).Items
   For Each xItem In xItems
       If Not (TypeOf xItem Is ContactItem) Then Exit Sub
       Set xContactItem = xItem
       xBirthdayDate = Month(xContactItem.Birthday) & "-" & Day(xContactItem.Birthday)
       If xBirthdayDate = xTodayDate Then
           Set xGreetingMail = Outlook.Application.CreateItemFromTemplate(xFilePath & "\Birthday Greeting Mail.oft")
           Set xWordDoc = xGreetingMail.GetInspector.WordEditor
           
           xWordDoc.Range.InsertBefore "Dear " & xContactItem.LastName & Chr(10) & xGreetings & Chr(10) & Chr(10)
           With xGreetingMail
                .Recipients.Add (xContactItem.Email1Address)
                .Subject = "Happy Birthday!"
                .Display
                .Close (olSave)
                .Send
          End With
       End If
   Next
End If
End Sub
Function IsFileExists(ByVal FileName As String) As Boolean
Dim xFileSystem As Object
Set xFileSystem = CreateObject("Scripting.FileSystemObject")
If xFileSystem.FileExists(FileName) = True Then
    IsFileExists = True
Else
    IsFileExists = False
End If
End Function 

3. Yna clcik offer > Cyfeiriadau yn y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr, yn y popped allan Cyfeiriadau-Prosiect1 blwch deialog, gwirio Llyfrgell Gwrthrychau Microsoft Word ac Amser Rhedeg Sgriptio Microsoft opsiynau o'r Cyfeiriadau sydd ar Gael blwch rhestr, gweler y screenshot:

4. Yna cliciwch OK i gau'r ymgom, nawr, dylech greu tasg i sbarduno'r cod VBA. Ewch i'r Gorchwyl pane, cliciwch Tasg Newydd i greu tasg:

(1.) Yn Pwnct llinell, dylech nodi Pwnc fel Anfon Post Cyfarch Pen-blwydd;

(2.) Yna cliciwch Ailddigwydd O dan y Gorchwyl tab;

(3.) Yn y Ail-ddigwydd Tasg blwch deialog, dewiswch Daily a nodi bob 1 diwrnod (au) opsiwn gan y Patrwm ailddigwyddiad adran;

5. Yna cliciwch OK i gau'r blwch deialog, dychwelyd i ffenestr y dasg, gosodwch nodyn atgoffa ar gyfer y dasg gylchol fel y dangosir y llun a ganlyn:

6. O hyn ymlaen, pan fydd y nodyn atgoffa yn rhybuddio, bydd y macro yn cael ei sbarduno ar unwaith. Bydd blwch deialog yn galw allan i'ch atgoffa i fewnosod y cyfarchion pen-blwydd fel y dangosir y llun a ganlyn:

7. Yna cliciwch OK botwm, anfonir post cyfarch at y cyswllt y mae ei ben-blwydd heddiw yn awtomatig.


Offer Cynhyrchiant Swyddfa Gorau

Kutools ar gyfer Rhagolwg - Dros 100 o Nodweddion Pwerus i Werthu Eich Outlook

🤖 Cynorthwy-ydd Post AI: E-byst pro ar unwaith gyda hud AI - un clic i atebion athrylith, tôn berffaith, meistrolaeth amlieithog. Trawsnewid e-bostio yn ddiymdrech! ...

📧 E-bostio Automation: Allan o'r Swyddfa (Ar gael ar gyfer POP ac IMAP)  /  Amserlen Anfon E-byst  /  Auto CC/BCC gan Reolau Wrth Anfon E-bost  /  Awto Ymlaen (Rheolau Uwch)   /  Auto Ychwanegu Cyfarchiad   /  Rhannwch E-byst Aml-Dderbynnydd yn Negeseuon Unigol yn Awtomatig ...

📨 Rheoli E-bost: Dwyn i gof E-byst yn Hawdd  /  Rhwystro E-byst Sgam gan Bynciau ac Eraill  /  Dileu E-byst Dyblyg  /  Chwilio Manwl  /  Cydgrynhoi Ffolderi ...

📁 Ymlyniadau ProArbed Swp  /  Swp Datgysylltu  /  Cywasgu Swp  /  Auto Achub   /  Datgysylltiad Auto  /  Cywasgiad Auto ...

🌟 Rhyngwyneb Hud: 😊Mwy o Emojis Pretty a Cŵl   /  Rhowch hwb i'ch Cynhyrchiant Outlook gyda Golygfeydd Tabbed  /  Lleihau Outlook Yn lle Cau ...

???? Rhyfeddodau un clic: Ateb Pawb ag Ymlyniadau Dod i Mewn  /   E-byst Gwrth-Gwe-rwydo  /  🕘Dangos Parth Amser yr Anfonwr ...

👩🏼‍🤝‍👩🏻 Cysylltiadau a Chalendr: Swp Ychwanegu Cysylltiadau O E-byst Dethol  /  Rhannwch Grŵp Cyswllt i Grwpiau Unigol  /  Dileu Atgoffa Pen-blwydd ...

Dros Nodweddion 100 Aros Eich Archwiliad! Cliciwch Yma i Ddarganfod Mwy.

 

 

Comments (5)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Good morning,
I've set this up exactly as outlined, I have Kutools installed, however, there's no Macro popup when the reminder activates. What information can I provide you to help me solve this?
This comment was minimized by the moderator on the site
how he come to know who's birthday is today.you not mention, from where he pick detail of the employee.one more thing, i want to send birthday mail to all employee email id.
This comment was minimized by the moderator on the site
I am using this code with outlook 2016. Followed all the steps but kutool popup is not coming as mentioned in last step
This comment was minimized by the moderator on the site
hay alguna forma para mac?
This comment was minimized by the moderator on the site
Buen día, podría indicar cómo el código obtiene y valida la fecha de nacimiento??? . Otra consulta es si funciona para una lista de usuarios. Es decir que valide sus fechas de nacimiento y les envíe automáticamente saludos de cumpleaños. Muchas gracias
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations