您可以從Excel中運行一個可以與Outlook進行交互並在日曆上創建和事件的宏嗎?Excel創建一個Outlook日曆事件
2
A
回答
1
只要您有權寫入共享日曆,就可以在任何文件夾中添加約會。
款待日曆作爲文件夾
Const olFolderInbox = 6
Const olAppointmentItem = 1 '1 = Appointment
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
'Finds your Inbox
Set objInbox = objNamespace.GetDefaultFolder(olFolderInbox)
'Gets the parent of your Inbox which gives the Users email
strFolderName = objInbox.Parent
Set objCalendar = objNamespace.Folders("Public folders - " & strFolderName).Folders("SubFolder1").Folders("subfolder of subfolder 1").Folders("Your Calendar")
Set objapt = objCalendar.Items.Add(olAppointmentItem)
objapt.Subject = "Test" 'Owner
objapt.Start = Date + TimeValue("08:00:00")
objapt.Duration = 60 * 8 'Duration(in minutes) OR End(I'm not sure so try both)
objapt.End= Date + TimeValue("16:00:00")
objapt.Save
0
對對方的回答略有改善,從蒂姆commment
Sub createappt()
Const olFolderCalendar = 9
Const olAppointmentItem = 1 '1 = Appointment
Set objOutlook = CreateObject("Outlook.Application")
'Set objOutlook = GetObject(, "Outlook.Application") ' outlook already open
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set Items = objNamespace.GetDefaultFolder(olFolderCalendar).Items
Set objCalendar = objNamespace.GetDefaultFolder(olFolderCalendar).Folders("subfolder")
Set objCalendar = objNamespace.GetDefaultFolder(olFolderCalendar) ' main calender
Set objapt = objCalendar.Items.Add(olAppointmentItem)
objapt.Subject = "Test" 'Owner
objapt.Start = Date + TimeValue("08:00:00")
objapt.Duration = 60 * 8 'Duration(in minutes) OR End(I'm not sure so try both)
objapt.End = Date + TimeValue("16:00:00")
objapt.Save
End Sub
0
鏈接 - http://excelexperts.com/Creating-appointments-for-outlook-in-VBA
Sub AddAppointments2()
' Create the Outlook session
Set myOutlook = CreateObject("Outlook.Application")
' Start at row 2
r = 2
Do Until Trim(Cells(r, 1).Value) = ""
For Each olapt In olFldr.Items
If TypeName(myApt) = "AppointmentItem" Then
If InStr(1, myApt.Subject, "Test and Tag", vbTextCompare) Then
myApt.Body = appt.Body & Cells(r, 2)
myApt.Save
Else
' Create the AppointmentItem
Set myApt = myOutlook.createitem(1)
' Set the appointment properties
myApt.Subject = Cells(r, 1).Value
myApt.Location = Cells(r, 2).Value
myApt.Start = Cells(r, 4).Value + TimeValue("08:00:00")
myApt.Duration = Cells(r, 5).Value
' If Busy Status is not specified, default to 2 (Busy)
If Trim(Cells(r, 6).Value) = "" Then
myApt.BusyStatus = 2
Else
myApt.BusyStatus = Cells(r, 6).Value
End If
If Cells(r, 7).Value > 0 Then
myApt.ReminderSet = True
myApt.ReminderMinutesBeforeStart = Cells(r, 7).Value
Else
myApt.ReminderSet = False
End If
myApt.Body = Cells(r, 12).Value
myApt.Save
r = r + 1
End If
End If
Next olapt
Loop
End Sub
相關問題
- 1. 無法創建Outlook日曆事件
- 2. Android創建日曆事件
- 3. DayPilot日曆創建事件
- 4. 鈦創建日曆事件
- 5. 創建CalDav日曆事件
- 6. 如何在laravel中創建Outlook日曆事件?
- 7. 將一個事件保存到多個Outlook日曆中
- 8. 創建一個PHP日曆
- 9. 從另一個系統創建Microsoft Outlook日曆條目(oracle db)
- 10. 想法創建一個日曆控件
- 11. 從excel導入日期到Outlook日曆
- 12. 在Excel中創建一個包含日曆日期的列
- 13. eventId和icalUID事件變得不一樣,在Outlook日曆和谷歌日曆之間創建
- 14. 谷歌日曆Notfiy當創建事件
- 15. 使用事件創建日曆Appcelerator Titanium
- 16. 創建谷歌日曆事件
- 17. 用PHP創建iCal日曆事件
- 18. 創建組日曆事件失敗
- 19. 在雅虎日曆中創建事件
- 20. 如何使用事件創建日曆
- 21. Google Apps腳本 - 創建日曆事件
- 22. 在SharePoint中創建日曆事件
- 23. 創建一個事件觸發Outlook上的提醒創建
- 24. 使用HTML創建一個週期性日曆事件
- 25. 導出日曆事件到谷歌日曆,ical,microsoft outlook
- 26. 如何將drupal事件日曆與Outlook日曆同步
- 27. 如何創建一個單日曆日曆作爲scooll日曆
- 28. Outlook 365 API - 創建日曆事件時禁用自動發送電子郵件
- 29. 在默認的安卓日曆中創建日曆事件
- 30. 可以全日曆創建一個多日事件作爲單獨的事件(事件peppers)每天
http://excelexperts.com/Creating-appointments-for-looklook-in-VBA –
看起來像是會幫助很多!謝謝! – orangehairbandit
你可以補充說,作爲一個答案,所以我們其他有用的靈魂不認爲這是一個沒有答案的問題? :) –