エクセルでアウトルックの予定表へ反映させるために下記のVBAを実行しています。
その際、自分以外の他人のアウトルック予定表にも同じものを反映させるためにはどのような処理が必要でしょうか。
'Outlook用の定義 Dim olApp As Outlook.Application Dim olNamespace As Outlook.Namespace Dim olFolder As Folder Dim olConItems As Outlook.Items Dim olItem As AppointmentItem Dim checkFlg As Long '重複チェックフラグ初期値設定 checkFlg = 0 'Excel用の定義 Dim wbBook As Workbook Dim wsSheet As Worksheet Dim lnContactCount As Long 'スクリーンの更新は行われません。 Application.ScreenUpdating = False 'Excelのブックとワークシートのオブジェクトを設定します。 Set wbBook = ThisWorkbook Set wsSheet = wbBook.Worksheets(1) wsSheet.Activate 'Outlookオブジェクトを設定し、MAPI名前空間を介してOutlookの予定表を取得します。 Set olApp = New Outlook.Application Set olNamespace = olApp.GetNamespace("MAPI") Set olFolder = olNamespace.GetDefaultFolder(olFolderCalendar) Set olConItems = olFolder.Items '取得結果を記述する行番号を指定します。2行目のセルから開始されることになります。 lnContactCount = 2 Dim rc As Integer rc = MsgBox("予定表へ登録しますか?", vbYesNo + vbQuestion, "確認") If rc = vbYes Then '予定表一覧の件数分繰り返す。 For i = lnContactCount To Cells(1, 1).End(xlDown).Row Set olItem = olApp.CreateItem(olAppointmentItem) With olItem .RequiredAttendees = Cells(i, 1) .OptionalAttendees = Cells(i, 2) .Subject = Cells(i, 3) .Body = Cells(i, 4) .Start = Cells(i, 5) .End = Format(Cells(i, 6), "yyyy/mm/dd hh:mm:ss") .Body = Format(Cells(i, 7), "yyyy/mm/dd hh:mm:ss") .Body = Cells(i, 8) '重複チェック For Each olItemBefor In olConItems If TypeName(olItemBefor) = "AppointmentItem" Then '登録されている予定表の件名と開始日時が一致していたらフラグを1にする If olItemBefor.Subject = .Subject And olItemBefor.Start = .Start Then checkFlg = 1 End If End If Next If checkFlg <> 1 Then 'ここで保存 olItem.Save End If End With '重複フラグリセット checkFlg = 0 Next Else MsgBox "処理を中断します" End If 'Null out the variables. Set olItem = Nothing Set olApp = Nothing 'Turn screen updating back on. Application.ScreenUpdating = True MsgBox "Outlook予定表の登録が完了しました!", vbInformation
End Sub