Note: The other languages of the website are Google-translated. Back to English

Kako samodejno odgovoriti na prejeta sporočila, ko ste zaposleni v Outlooku?

Včasih želite samodejno odgovoriti na prejeta sporočila v Outlooku, ko ste zasedeni v določenem obdobju. Vendar ni vgrajene funkcije, ki bi lahko opravila to nalogo, vendar imam tukaj kodo VBA, ki bi jo obravnavala.

Samodejni odgovor, ko ste zasedeni s kodo VBA


Samodejni odgovor, ko ste zasedeni s kodo VBA

Kartica Office - omogočite urejanje in brskanje z zavihki v storitvi Office ter olajšajte delo ...
Kutools za Outlook - prinaša 100 zmogljivih naprednih funkcij v Microsoft Outlook
  • Samodejno CC / BCC po pravilih pri pošiljanju e-pošte; Samodejno posredovanje naprej Več e-poštnih sporočil po pravilih; Samodejni odgovor brez strežnika za izmenjavo in več samodejnih funkcij ...
  • Opozorilo pred BCC - prikaže sporočilo, ko poskušate odgovoriti na vse, če je vaš poštni naslov na seznamu BCC; Opomni, ko manjkajo priloge, in več opomnikov ...
  • Odgovori (vsi) z vsemi prilogami v pogovoru po pošti; Odgovori na več e-poštnih sporočil hkrati; Samodejno dodaj pozdrav ko odgovor; Samodejno dodaj datum in čas v zadevo ...
  • Orodja za pritrditev: Samodejno loči, Stisni vse, Preimenuj vse, Samodejno shrani vse ... Hitro poročilo, Preštej izbrano pošto, Odstranitev podvojenih e-poštnih sporočil in stikov ...
  • Več kot 100 naprednih funkcij bo rešiti večino svojih težav v Outlooku 2010-2019 in 365. Polne funkcije 60-dnevnega brezplačnega preskusa.

Tu je koda VBA, ki bo samodejno odgovorila, medtem ko je v koledarju Outlooka nekaj sestankov. Če v koledarju ni ničesar, samodejno preneha odgovarjati.

1. Pritisnite Alt + F11 tipke za odpiranje Microsoft Visual Basic za aplikacije okno.

2. Dvokliknite na Ta OutlookSession Iz Project1 podokno, kopirajte in prilepite spodnjo kodo v skript.

VBA: Samodejno odgovorite, ko ste zaposleni v koledarju

Public WithEvents xInboxItems As Outlook.Items

Private Sub Application_Startup()
Set xInboxItems = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub xInboxItems_ItemAdd(ByVal Item As Object)
'UpdatebyExtendoffice20180418
Dim xMailItem As Outlook.MailItem
Dim xReplyMailItem As Outlook.MailItem
Dim xReplyHTMLBody As String
Dim xAppointments As Outlook.Items
Dim xFilter As String
Dim xRestrictAppointments As Outlook.Items
Dim xAppointment As Outlook.AppointmentItem
Dim xDateFormat As String
On Error Resume Next
If TypeOf Item Is MailItem Then
    Set xMailItem = Item
    Set xReplyMailItem = xMailItem.Reply
    xReplyHTMLBody = xReplyMailItem.HTMLBody
    Set xAppointments = Outlook.Application.Session.GetDefaultFolder(olFolderCalendar).Items
    xAppointments.Sort "[Start]"
    xAppointments.IncludeRecurrences = True
    xDateFormat = Format(Now, "ddddd h:nn AMPM")
    xFilter = "[Start]<= '" & xDateFormat & "' AND [End]>= '" & xDateFormat & "'"
    Set xRestrictAppointments = xAppointments.Restrict(xFilter)
    If TypeName(xRestrictAppointments) = "Nothing" Then Exit Sub
    For Each xAppointment In xRestrictAppointments
        If xAppointment.BusyStatus = olBusy Or olOutOfOffice Then
            xReplyMailItem.HTMLBody = "<HTML><BODY>I'm Sorry that I can't respond to you right now. I'll reply to you later.</HTML></BODY>" & _
                                      xReplyHTMLBody
            xReplyMailItem.Send
        End If
    Next
End If
End Sub

3. Save this code and restart the Outlook. From now on, if the emails are receiving in the time range of your appointments, an auto reply will be sent.

Tips:

(1) In the code, you can change the reply body as you need in this script "I'm Sorry that I can't respond to you right now. I'll reply to you later." & _

(2) This VBA macro can automatically reply emails received in the Inbox of default data file.


Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
  • Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
  • Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
 
Comments (1)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi
How to modify your VBA code for taking into account only all day events with specific names, pls?I've no clue in coding... :(
Thank you in advance.
BR
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations