0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Excel VBAで、Outlookの予定を追加してみた

Posted at

#Excel VBAで、Outlookの予定を追加してみた
Outlookで予定表を入れるとき、Outlookの予定の入力画面が多機能すぎるので、入力時に間違えることが多い。単にシンプルにExcelで前回の入力も保存できたりするので、VBAでつくってみた。
###新規で予定を作成する
Excelのセルに、あらかじめ次のシートを準備しておく
olvba.png
このB1~B5に入力されたデータをOutlookの予定として新規登録するようにした

###新規でOutlookの予定を登録するマクロ

Sub 予定の作成() 
    Dim objOL        As Object
    Dim objApp       As Object
    Dim strSubject   As String
    Dim strStart     As String
    Dim strEnd       As String
    Dim strLocation  As String
    Dim lngRemind    As Long
    Dim strBody      As String
    Dim olAppointmentItem As Integer

    olAppointmentItem = 1

    Set objOL = CreateObject("Outlook.Application")
    strSubject = Sheet1.Range("B1")
    strLocation = Sheet1.Range("B2")
    strStart = Sheet1.Range("B3")
    strEnd = Sheet1.Range("B4")
    lngRemind = Sheet1.Range("B5")
    strBody = Sheet1.Range("B6")
        
    Set objApp = objOL.CreateItem(olAppointmentItem)
    With objApp
        .Subject = strSubject
        .Location = strLocation
        .Start = strStart
        .End = strEnd
        .Body = strBody
        .ReminderMinutesBeforeStart = lngRemind
        .ReminderSet = True
        .Save
    End With
    Set objApp = Nothing
    Set objOL = Nothing
End Sub

###つづきは
定期的な予定の登録、なんぞこれから作ってみようと思います。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?