Bonbon ede nou delivre sèvis nou yo. Lè l sèvi avèk sèvis nou yo, ou dakò pou nou sèvi ak bonbon.
Ide: Lòt lang yo se Google-tradui. Ou ka vizite a English vèsyon nan lyen sa a.
Ouvri yon sesyon
x
or
x
x
enskri
x

or

Ki jan yo kreye randevou soti nan done Excel?

Sipoze, ou gen yon tab nan done randevou nan yon Fèy travay Excel jan sa a D esplike yo montre, kounye a, ou vle enpòte done sa yo nan kalandriye pespektiv. Ki jan ou ka fè fas ak travay sa a byen vit?

doc ekspòte briye done randevou 1

Kreye randevou nan done Excel ak kòd VBA


Kreye randevou nan done Excel ak kòd VBA

Pou kreye randevou nan done Excel, ou ka aplike kòd sa a VBA, tanpri fè tankou sa a:

1. Lanse Outlook epi kenbe desann nan ALT + F11 kle yo louvri a Microsoft Visual Basic pou aplikasyon pou fenèt.

2. Klike sou Antre > Modil, epi kole kòd sa a nan la Modil Fenèt.

VBA postal: Import done briye nan randevou:

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. Toujou nan la Microsoft Visual Basic pou aplikasyon pou fenèt, klike Zouti > Referans pou yo ale nan la Referans-Project1 bwat dyalòg, epi tcheke Microsoft Excel Bibliyotèk objè opsyon soti nan la Referans ki disponib lis bwat, al gade Ekran:

doc ekspòte briye done randevou 2

4. Lè sa a, klike sou OK bouton, kounye a, peze F5 kle nan kouri kòd sa a, ak yon Chwazi yon dosye fenèt la parèt, tanpri chwazi dosye a briye ou vle enpòte pespektiv, al gade Ekran:

doc ekspòte briye done randevou 3

5. Lè sa a, klike sou OK, se yon bwat èd memwa popped out jan sa a:

doc ekspòte briye done randevou 4

6. Lè sa a, klike sou OK, done yo Excel te enpòte nan kalandriye a jan sa a Ekran yo montre:

doc ekspòte briye done randevou 5



Kutools pou pespektiv

Plis pase 100 Fonksyon avanse pou pespektiv 2010, 2013, 2016, 2019 ak 365

ekran piki kutools pou pespektiv ti pou banyè 201812

Plis Features | Telechaje gratis | Se sèlman $ 39.00 pou dè santèn de fonksyon

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.