메인 컨텐츠로 가기

Excel 데이터에서 약속을 만드는 방법은 무엇입니까?

다음 스크린 샷과 같이 Excel 워크 시트에 약속 데이터 테이블이 있다고 가정하면 이제 이러한 데이터를 Outlook 일정으로 가져 오려고합니다. 이 일을 어떻게 빨리 처리 할 수 ​​있습니까?

문서 내보내기는 약속에 데이터를 엑셀 1

VBA 코드를 사용하여 Excel 데이터에서 약속 만들기


VBA 코드를 사용하여 Excel 데이터에서 약속 만들기

Excel 데이터에서 약속을 만들려면 다음 VBA 코드를 적용 할 수 있습니다.

1. Outlook을 시작하고 ALT + F11 키를 눌러 응용 프로그램 용 Microsoft Visual Basic 창.

2. 딸깍 하는 소리 끼워 넣다 > 모듈을 클릭하고 다음 코드를 모듈 창문.

VBA 코드 : Excel 데이터를 약속으로 가져 오기 :

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. 여전히 응용 프로그램 용 Microsoft Visual Basic 창을 클릭합니다 도구 > 참고자료 로 이동합니다 참조 -Project1 대화 상자 및 확인 Microsoft Excel 개체 라이브러리 옵션에서 사용 가능한 참조 목록 상자, 스크린 샷 참조 :

문서 내보내기는 약속에 데이터를 엑셀 2

4. 그런 다음 OK 버튼을 눌러 F5 이 코드를 실행하는 키와 파일 선택 창이 표시되면 Outlook으로 가져올 Excel 파일을 선택하십시오. 스크린 샷을 참조하십시오.

문서 내보내기는 약속에 데이터를 엑셀 3

5. 그런 다음 OK, 프롬프트 상자가 다음과 같이 나타납니다.

문서 내보내기는 약속에 데이터를 엑셀 4

6. 그런 다음 OK, Excel 데이터는 다음 스크린 샷과 같이 캘린더로 가져 왔습니다.

문서 내보내기는 약속에 데이터를 엑셀 5


최고의 사무 생산성 도구

Outlook 용 Kutools - 귀하의 전망을 강화하는 100개 이상의 강력한 기능

🤖 AI 메일 도우미: AI 마법이 적용된 즉각적인 전문가 이메일 - 원클릭으로 천재적인 답변, 완벽한 어조, 다국어 숙달이 가능합니다. 손쉽게 이메일을 변환하세요! ...

📧 이메일 자동화: 부재중(POP 및 IMAP에서 사용 가능)  /  이메일 보내기 예약  /  이메일 발송 시 규칙에 따른 자동 참조/숨은참조  /  자동 전달(고급 규칙)   /  인사말 자동 추가   /  여러 수신자 이메일을 개별 메시지로 자동 분할 ...

📨 이메일 관리: 이메일을 쉽게 기억할 수 있습니다.  /  제목 및 기타 사기 이메일 차단  /  중복 이메일 삭제  /  고급 검색  /  폴더 통합 ...

📁 첨부 파일 프로일괄 저장  /  일괄 분리  /  일괄 압축  /  자동 저장   /  자동 분리  /  자동 압축 ...

🌟 인터페이스 매직: 😊더 예쁘고 멋진 이모티콘   /  탭 보기로 Outlook 생산성 향상  /  문을 닫는 대신 전망을 최소화하세요 ...

???? 원클릭 불가사의: 수신 첨부 파일과 함께 전체 회신  /   피싱 방지 이메일  /  🕘발신자의 시간대 표시 ...

👩🏼‍🤝‍👩🏻 연락처 및 캘린더: 선택한 이메일에서 연락처 일괄 추가  /  연락처 그룹을 개별 그룹으로 분할  /  생일 알림 제거 ...

이상 100 특징 당신의 탐험을 기다려주세요! 더 알아보려면 여기를 클릭하세요.

 

 

Comments (3)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Returns "Compile error: User-defined type not defined"
This comment was minimized by the moderator on the site
Hello,

Thank you so much but the code is not executing successfully when creating appointments in a shared calendar. Could you please help
This comment was minimized by the moderator on the site
super cool il ya une erreur je la i rectifier mai apparament mes items colle pas mince



olApp = Nothing ?
xExcelApp.Quit
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations