Kidokezo: Lugha zingine ni Google-Ilitafsiriwa. Unaweza kutembelea English toleo la kiungo hiki.
Ingia
x
or
x
x
Daftari
x

or

Jinsi ya kuunda uteuzi kutoka kwa data ya Excel?

Ikifikiri, una meza ya data ya uteuzi kwenye karatasi ya Excel kama skrini ifuatayo iliyoonyeshwa, sasa, unataka kuingiza data hizi kwenye kalenda ya Outlook. Je! Unaweza kushughulikia kazi hii haraka?

doc kuuza nje ya data kwa uteuzi 1

Unda uteuzi kutoka kwa data ya Excel na msimbo wa VBA


Unda uteuzi kutoka kwa data ya Excel na msimbo wa VBA

Kuunda uteuzi kutoka kwa data ya Excel, unaweza kutumia kanuni ya VBA ifuatayo, tafadhali fanya kama hii:

1. Kuzindua Outlook na kushikilia ALT + F11 funguo za kufungua Microsoft Visual Msingi kwa Maombi dirisha.

2. Bonyeza Ingiza > Modules, na ushirike nambari ifuatayo katika Modules Dirisha.

Nambari ya VBA: Ingiza data bora kwa kuteuliwa:

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. Bado katika Microsoft Visual Msingi kwa Maombi dirisha, bonyeza zana > Marejeo kwenda Marejeo-Project1 dialog box, na angalia Maktaba ya Kitufe cha Microsoft Excel chaguo kutoka Marejeo Inapatikana Weka sanduku, angalia skrini:

doc kuuza nje ya data kwa uteuzi 2

4. Kisha bonyeza OK kifungo, sasa, bonyeza F5 ufunguo wa kuendesha msimbo huu, na Chagua faili dirisha inavyoonyeshwa, tafadhali chagua faili iliyo bora zaidi ya kuagiza kwa Outlook, angalia skrini:

doc kuuza nje ya data kwa uteuzi 3

5. Kisha bonyeza OK, sanduku la haraka linakuja kama ifuatavyo:

doc kuuza nje ya data kwa uteuzi 4

6. Kisha bonyeza OK, data ya Excel imeagizwa kwenye kalenda kama skrini ifuatayo iliyoonyeshwa:

doc kuuza nje ya data kwa uteuzi 5



Kutools kwa Outlook

Zaidi ya kazi za 100 za Juu kwa Outlook 2010, 2013, 2016, 2019 na 365

skrini ya kutosha ya skrini kwa vidogo vidogo vya bendera 201812

Makala zaidi | bure Download | Tu $ 39.00 kwa mamia ya kazi

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.