Μετάβαση στο κύριο περιεχόμενο

Πώς να δημιουργήσετε υπενθυμίσεις του Outlook από το υπολογιστικό φύλλο του Excel;

Αυτό το άρθρο αναφέρεται στη δημιουργία υπενθυμίσεων του Outlook βάσει δεδομένων του υπολογιστικού φύλλου Excel.

Υπενθυμίσεις Crete Outlook από υπολογιστικό φύλλο Excel με κώδικα VBA


Δημιουργήστε υπενθυμίσεις του Outlook από υπολογιστικό φύλλο Excel με κώδικα VBA

Εάν θέλετε να δημιουργήσετε υπενθυμίσεις του Outlook από το Excel, κάντε τα εξής.

1. Δημιουργήστε ένα φύλλο εργασίας που περιέχει τις κεφαλίδες στηλών και τα αντίστοιχα πεδία υπενθύμισης όπως φαίνεται στο παρακάτω στιγμιότυπο οθόνης.

Note: Για το απασχολημένη κατάσταση στήλη, αριθμός 2 σημαίνει ότι η υπενθύμιση θα εμφανίζεται ως Απασχολημένος στο ημερολόγιο του Outlook. Μπορείτε να το αλλάξετε σε 1 (Προσοχή), 3 (εκτός γραφείου), 4 (Εργασία αλλού), ή 5 (δωρεάν) όπως χρειάζεστε.

2. Πάτα το άλλος + F11 για να ανοίξετε το Microsoft Visual Basic για εφαρμογές παράθυρο.

3. Στο Microsoft Visual Basic για εφαρμογές παράθυρο, κάντε κλικ στην επιλογή Κύριο θέμα > Μονάδα μέτρησης. Στη συνέχεια, αντιγράψτε κάτω από τον κώδικα VBA στο παράθυρο Code.

Κωδικός VBA: Δημιουργία υπενθυμίσεων Outlook από υπολογιστικό φύλλο Excel

Sub AddAppointments()
'Update by Extendoffice 20180608
    Dim I As Long
    Dim xRg As Range
    Dim xOutApp As Object
    Dim xOutItem As Object
    Set xOutApp = CreateObject("Outlook.Application")
    Set xRg = Range("A2:G2")
    For I = 1 To xRg.Rows.Count
        Set xOutItem = xOutApp.createitem(1)
        Debug.Print xRg.Cells(I, 1).Value
        xOutItem.Subject = xRg.Cells(I, 1).Value
        xOutItem.Location = xRg.Cells(I, 2).Value
        xOutItem.Start = xRg.Cells(I, 3).Value
        xOutItem.Duration = xRg.Cells(I, 4).Value
        If Trim(xRg.Cells(I, 5).Value) = "" Then
            xOutItem.BusyStatus = 2
        Else
            xOutItem.BusyStatus = xRg.Cells(I, 5).Value
        End If
        If xRg.Cells(I, 6).Value > 0 Then
            xOutItem.ReminderSet = True
            xOutItem.ReminderMinutesBeforeStart = xRg.Cells(I, 6).Value
        Else
            xOutItem.ReminderSet = False
        End If
        xOutItem.Body = xRg.Cells(I, 7).Value
        xOutItem.Save
        Set xOutItem = Nothing
    Next
    Set xOutApp = Nothing
End Sub

Note: Στον παραπάνω κώδικα, A2: G2 είναι το εύρος δεδομένων στο οποίο θέλετε να δημιουργήσετε συναντήσεις βάσει.

4. Πάτα το F5 ή κάντε κλικ στο κουμπί Εκτέλεση για να εκτελέσετε τον κωδικό. Στη συνέχεια, όλα τα ραντεβού με συγκεκριμένα πεδία θα εισαχθούν ταυτόχρονα στο ημερολόγιο του Outlook.

Στη συνέχεια, μπορείτε να μεταβείτε στο Ημερολόγιο των προοπτικών σας για να δείτε τα αποτελέσματα, Δείτε το στιγμιότυπο οθόνης: 


Τα καλύτερα εργαλεία παραγωγικότητας γραφείου

Kutools για το Outlook - Πάνω από 100 ισχυρές δυνατότητες για υπερφόρτιση του Outlook σας

🤖 Βοηθός αλληλογραφίας AI: Άμεσα επαγγελματικά email με μαγεία AI -- με ένα κλικ για ιδιοφυείς απαντήσεις, τέλειος τόνος, πολυγλωσσική γνώση. Μεταμορφώστε τα email χωρίς κόπο! ...

📧 Αυτοματοποίηση ηλεκτρονικού ταχυδρομείου: Εκτός γραφείου (Διαθέσιμο για POP και IMAP)  /  Προγραμματισμός αποστολής email  /  Αυτόματο CC/BCC βάσει κανόνων κατά την αποστολή email  /  Αυτόματη προώθηση (Σύνθετοι κανόνες)   /  Αυτόματη προσθήκη χαιρετισμού   /  Διαχωρίστε αυτόματα τα μηνύματα ηλεκτρονικού ταχυδρομείου πολλών παραληπτών σε μεμονωμένα μηνύματα ...

📨 Διαχείριση e-mail: Εύκολη ανάκληση email  /  Αποκλεισμός απάτης email από υποκείμενα και άλλους  /  Διαγραφή διπλότυπων μηνυμάτων ηλεκτρονικού ταχυδρομείου  /  Προχωρημένη Αναζήτηση  /  Ενοποίηση φακέλων ...

📁 Συνημμένα ProΜαζική αποθήκευση  /  Αποσύνδεση παρτίδας  /  Συμπίεση παρτίδας  /  Αυτόματη αποθήκευση   /  Αυτόματη απόσπαση  /  Αυτόματη συμπίεση ...

🌟 Διασύνδεση Magic: 😊Περισσότερα όμορφα και δροσερά emojis   /  Ενισχύστε την παραγωγικότητά σας στο Outlook με προβολές με καρτέλες  /  Ελαχιστοποιήστε το Outlook αντί να κλείσετε ...

???? Με ένα κλικ Wonders: Απάντηση σε όλους με εισερχόμενα συνημμένα  /   Email κατά του phishing  /  🕘Εμφάνιση ζώνης ώρας αποστολέα ...

👩🏼‍🤝‍👩🏻 Επαφές & Ημερολόγιο: Μαζική προσθήκη επαφών από επιλεγμένα μηνύματα ηλεκτρονικού ταχυδρομείου  /  Διαχωρίστε μια ομάδα επαφής σε μεμονωμένες ομάδες  /  Κατάργηση υπενθυμίσεων γενεθλίων ...

Διανεμήθηκαν παραπάνω από 100 Χαρακτηριστικά Περιμένετε την εξερεύνηση σας! Κάντε κλικ εδώ για να ανακαλύψετε περισσότερα.

 

 

Comments (66)
Rated 5 out of 5 · 2 ratings
This comment was minimized by the moderator on the site
How can I make this module run automatically when I close Excel? That way I can input data, and only have to close the file without having to manually run the code?
This comment was minimized by the moderator on the site
Hi JAIME GARCIA,
To make the AddAppointments subroutine run automatically when you close the Excel workbook, you can apply the following VBA code. This event is triggered right before the workbook is closed. Here's how you can adjust the code to run when the workbook is closed:
1. Open the Excel workbook where you want this functionality.
2. Press Alt + F11 to open the VBA editor.
3. In the Project Explorer on the left side, find ThisWorkbook under the VBAProject for your workbook.
4. Double-click ThisWorkbook to open its code module.
5. In the code window for ThisWorkbook, insert the following code.
6. Now you need to save this workbook as Excel Macro-Enabled Workbook (click File > Save As > choose Excel Macro-Enabled Workbook from Save as Type drop-down list > click Save).

Note: In this code, be sure to replace "SheetName" with the actual name of the worksheet containing your appointment data.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    AddAppointments
End Sub

Sub AddAppointments()
    ' Updated by Extendoffice 20180608
    Dim I As Long
    Dim xRg As Range
    Dim xOutApp As Object
    Dim xOutItem As Object
    Set xOutApp = CreateObject("Outlook.Application")
    Set xRg = ThisWorkbook.Sheets("SheetName").Range("A2:G2") ' Replace "SheetName" with the actual name of your sheet
    
    For I = 1 To xRg.Rows.Count
        Set xOutItem = xOutApp.createitem(1)
        xOutItem.Subject = xRg.Cells(I, 1).Value
        xOutItem.Location = xRg.Cells(I, 2).Value
        xOutItem.Start = xRg.Cells(I, 3).Value
        xOutItem.Duration = xRg.Cells(I, 4).Value
        xOutItem.BusyStatus = IIf(Trim(xRg.Cells(I, 5).Value) = "", 2, xRg.Cells(I, 5).Value)
        xOutItem.ReminderSet = xRg.Cells(I, 6).Value > 0
        xOutItem.ReminderMinutesBeforeStart = IIf(xOutItem.ReminderSet, xRg.Cells(I, 6).Value, 0)
        xOutItem.Body = xRg.Cells(I, 7).Value
        xOutItem.Save
        Set xOutItem = Nothing
    Next I
    Set xOutApp = Nothing
End Sub
This comment was minimized by the moderator on the site
Hello:

Thank you all for this amazing forum. I hope you will forgive me if this has already been asked, but is there a way to tweak the code to create an Outlook TASK instead of an appointment?

Please advise.

David
Rated 5 out of 5
This comment was minimized by the moderator on the site
How can I revise the code to include multiple rows?
This comment was minimized by the moderator on the site
HI Miller,

In this line Set xRg = Range("A2:G2") of the code, simply change the range "A2:G2" to a range containing multiple rows, such as "A2:G10"
This comment was minimized by the moderator on the site
This is a great tool. Was wondering if there is a way to add the appointments to a shared calendar, instead of my personal outlook calendar.
This comment was minimized by the moderator on the site
HI Crystal,
the code worked find, but I made some changes in Table & run the code again, now I have 2 reminders for same event, how to remove 1st reminder from my outlook calendar.
This comment was minimized by the moderator on the site
Hi Sushant Gawali,

The code only helps you to create reminders from Excel. If a duplicate reminder is created, you will need to go to the Outlook calendar to delete it manually. Sorry for the inconvenience.
This comment was minimized by the moderator on the site
If we share the excel with other user and they run this micro-enabled filed, will they have all the invites saved?
This comment was minimized by the moderator on the site
Hi,
If you save this Excel file as an Excel Macro-Enabled Workbook and send it to someone else, the invitation will be saved in their Outlook calendar after running the VBA code.
This comment was minimized by the moderator on the site
Excellent, thanks!
Rated 5 out of 5
This comment was minimized by the moderator on the site
Hi Crystal,

Thank you for letting me know.
This comment was minimized by the moderator on the site
Thank you for posting your code, it works perfectly for me for adding to Outlook. Is there a way to add it to a Google Calendar instead?

Thanks.
This comment was minimized by the moderator on the site
Hi David Ramsay,
I can’t fix this problem. Sorry about that.
This comment was minimized by the moderator on the site
Hello,

For some reason it won’t pull all dates.
My range is A2:C14 and it seems to cherry pick dates. Any tips?
This comment was minimized by the moderator on the site
Hi Hailey,
You may need to attach a screenshot or a sample file to describe the problem you encountered more clearly.
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