0
0

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.

テスト50

Posted at

Option Explicit

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

'日報を送るときの時間別件名チェックサンプル
'(ThisOutlookSession)
'メモメモφ(・ω・*)
'---------------------------------------------
'朝
If InStr(Item.Subject, "【○○】") > 0 _
And TimeValue(Now) >= TimeValue("8:30") _
And TimeValue(Now) <= TimeValue("9:30") Then

    If InStr(Item.Subject, "開始") > 0 Then
        '問題なければ送信
        Exit Sub
    
    Else
    
        MsgBox "件名が違っています。もう一度確認をお願いします。", vbCritical
        Cancel = True
        Exit Sub
        
    End If

End If

'---------------------------------------------
'昼
If InStr(Item.Subject, "【○○】") > 0 _
And TimeValue(Now) >= TimeValue("8:30") _
And TimeValue(Now) <= TimeValue("9:30") Then

    If InStr(Item.Subject, "開始") > 0 Then
        '問題なければ送信
        Exit Sub
    
    Else
    
        MsgBox "件名が違っています。もう一度確認をお願いします。", vbCritical
        Cancel = True
        Exit Sub
        
    End If

End If

'---------------------------------------------
'退社
If InStr(Item.Subject, "【○○】") > 0 _
And TimeValue(Now) >= TimeValue("8:30") _
And TimeValue(Now) <= TimeValue("9:30") Then

    If InStr(Item.Subject, "開始") > 0 Then
        '問題なければ送信
        Exit Sub
    
    Else
    
        MsgBox "件名が違っています。もう一度確認をお願いします。", vbCritical
        Cancel = True
        Exit Sub
        
    End If

End If

End Sub
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?