Koekies help om ons dienste te lewer. Deur die gebruik van ons dienste, stem jy in tot ons gebruik van koekies.
Wenk: Ander tale is Google-vertaal. U kan die English weergawe van hierdie skakel.
Teken aan
x
or
x
x
registreer
x

or

Hoe maak jy afspraak uit Excel-data?

Veronderstel, jy het 'n tabel van afspraakdata in 'n Excel-werkblad as die volgende skermkiekie, nou wil jy hierdie data invoer in die Outlook-kalender. Hoe kan jy hierdie werk vinnig hanteer?

doc uitvoer Excel data na afspraak 1

Skep aanstellings uit Excel-data met VBA-kode


Skep aanstellings uit Excel-data met VBA-kode

Om afsprake uit Excel-data te skep, kan u die volgende VBA-kode toepas, doen asseblief soos volg:

1. Begin Outlook en hou die ALT + F11 sleutels om die Microsoft Visual Basic vir toepassings venster.

2. Kliek Plaas > module, en plak die volgende kode in die module Venster.

VBA-kode: invoer Excel-data na afspraak:

Public Sub CreateOutlookApptz()
    Dim xAppointmentItem As Outlook.AppointmentItem
    Dim xNameSpace As Outlook.NameSpace
    Dim xCalendarFld As Outlook.MAPIFolder, xSubFolder As Outlook.MAPIFolder
    Dim xCalendarStr As String
    Dim I As Long
    Dim xFileDialog As FileDialog
    Dim xFilePath As String
    Dim xExcelApp As Excel.Application
    Dim xWb As Workbook
    Dim xWs As Worksheet
    On Error GoTo Err_Execute
    Set xExcelApp = New Excel.Application
    Set xFileDialog = xExcelApp.FileDialog(msoFileDialogFilePicker)
    With xFileDialog
        .Title = "Select a file"
        .Filters.Add "Microsoft Excel", "*.xlsx"
    End With
    If xFileDialog.Show = 0 Then Exit Sub
    xFilePath = xFileDialog.SelectedItems(1)
    Set xWb = xExcelApp.Workbooks.Open(xFilePath)
    Set xNameSpace = Outlook.Application.Session
    Set xCalendarFld = xNameSpace.GetDefaultFolder(olFolderCalendar)
    I = 2
    Set xWs = xWb.Worksheets.Item(1)
    xCalendarStr = xWb.Name
    If FolderExist(xCalendarFld, xCalendarStr) = False Then
        Set xSubFolder = xCalendarFld.Folders.Add(xCalendarStr, olFolderCalendar)
    Else
        Set xSubFolder = xCalendarFld.Folders(xCalendarStr)
    End If
    Do Until Trim(xWs.Cells(I, 1).Value) = ""
        Set xAppointmentItem = xSubFolder.Items.Add(olAppointmentItem)
        With xAppointmentItem
            .Start = xWs.Cells(I, 5) + xWs.Cells(I, 6)
            .End = xWs.Cells(I, 7) + xWs.Cells(I, 8)
            .Subject = xWs.Cells(I, 1)
            .Location = xWs.Cells(I, 2)
            .Body = xWs.Cells(I, 3)
            .BusyStatus = olBusy
            .ReminderMinutesBeforeStart = xWs.Cells(I, 9)
            .ReminderSet = True
            .Categories = xWs.Cells(I, 4)
            .Save
        End With
        I = I + 1
    Loop
    Set xAppointmentItem = Nothing
    Set olApp = Nothing
    xExcelApp.Quit
    Set xExcelApp = Nothing
    MsgBox "Import successfully!", vbInformation, "Kutools for Outlook"
    Exit Sub
Err_Execute:
    MsgBox "An error occurred - Exporting items to Calendar.", vbInformation, "Kutools for Outlook"
End Sub
Function FolderExist(CalFolder As Folder, FolderName As String) As Boolean
    Dim I As Integer
    Dim xSubFolder As Folder
    For I = 1 To CalFolder.Folders.Count
        Set xSubFolder = CalFolder.Folders.Item(I)
        If xSubFolder.Name = FolderName Then
            FolderExist = True
            Exit Function
        End If
    Next I
End Function

3. Nog in die Microsoft Visual Basic vir toepassings venster, kliek Gereedskap > Verwysings om te gaan na die Verwysings-Project1 dialoogkassie, en tjek Microsoft Excel Object Library Opsie uit die Beskikbare verwysings lys boks, sien skermkiekie:

doc uitvoer Excel data na afspraak 2

4. Klik dan OK Knoppie, nou, druk F5 sleutel om hierdie kode uit te voer, en a Kies 'n lêer venster word vertoon, kies asseblief die Excel-lêer wat u wil invoer in Outlook, sien skermkiekie:

doc uitvoer Excel data na afspraak 3

5. En klik dan OK, 'n vinnige boks is soos volg uitgedruk:

doc uitvoer Excel data na afspraak 4

6. Klik dan OK, is die Excel-data in die kalender ingevoer as die volgende skermkiekie:

doc uitvoer Excel data na afspraak 5



Kutools for Outlook

Meer as 100 Gevorderde funksies vir Outlook 2010, 2013, 2016, 2019 en 365

skermskut kutools vir uitsig klein vir banner 201812

Meer funksies | Gratis aflaai | Slegs $ 39.00 vir honderde funksies

Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.