Cuidiú fianáin linn ár seirbhísí a sheachadadh. Trí úsáid a bhaint ár gcuid seirbhísí, aontaíonn tú úsáid a bhainimid as fianáin.
Leid: Aistrítear Google-theangacha eile. Is féidir leat cuairt a thabhairt ar an English leagan den nasc seo.
Logáil isteach
x
or
x
x
Cláraigh
x

or

Conas ceapachán a chruthú ó shonraí Excel?

Má tharlaíonn, tá tábla sonraí ceaptha agat i mbileog oibre Excel mar seo a leanas a thaispeántar an scáileán, anois, ba mhaith leat na sonraí sin a iompórtáil isteach sa fhéilire Outlook. Cén chaoi ar féidir leat déileáil leis an bpost seo go tapa?

Excel onnmhairiú sonraí a cheapadh chun ceapachán 1

Ceapacháin a chruthú ó shonraí Excel le cód VBA


Ceapacháin a chruthú ó shonraí Excel le cód VBA

Chun ceapacháin a chruthú ó shonraí Excel, is féidir leat an cód VBA seo a leanas a chur i bhfeidhm, déan mar seo:

1. Seoladh Outlook agus sealbhóidh sé síos an ALT + F11 eochracha a oscailt Microsoft Visual Basic d'Iarratais fhuinneog.

2. Cliceáil Ionsáigh > Modúil, agus greamaigh an cód seo a leanas sa Modúil Fuinneog.

Cód VBA: Iompórtáil sonraí a cheapadh chun ceapacháin:

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. Fós sa Microsoft Visual Basic d'Iarratais fuinneog, cliceáil uirlisí > tagairtí chun dul go dtí an Tagairtí-Project1 dialóg, agus seiceáil Leabharlann Excel Object Object rogha ón Tagairtí ar Fáil liosta bosca, féach ar an scáileán:

Excel onnmhairiú sonraí a cheapadh chun ceapachán 2

4. Ansin cliceáil OK cnaipe, anois, brúigh F5 eochair chun an cód seo a reáchtáil, agus a Roghnaigh comhad cuirtear an fhuinneog ar taispeáint, roghnaigh an comhad barr is mian leat a allmhairiú chuig Outlook, féach an scáileán:

Excel onnmhairiú sonraí a cheapadh chun ceapachán 3

5. Agus ansin cliceáil OK, cuirtear bosca pras amach mar seo a leanas:

Excel onnmhairiú sonraí a cheapadh chun ceapachán 4

6. Ansin cliceáil OK, tá na sonraí Excel curtha in iúl sa féilire mar a leanas a thaispeántar an scáileán:

Excel onnmhairiú sonraí a cheapadh chun ceapachán 5



Kutools le haghaidh Outlook

Níos mó ná 100 Feidhmeanna Casta le haghaidh Outlook 2010, 2013, 2016, 2019 agus 365

Scáileán ar nósanna imeachta le haghaidh dearcadh bídeach don bhratach 201812

Gnéithe níos mó | Free Download | Níl ach $ 39.00 ar na céadta feidhmeanna

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.