created and maintained by tokd

OutlookTips

Outlookで定型句をランダムに選択して挿入するマクロ


Unixのfortuneコマンドのような感じ。今日の一言を入れたりするのにも使える。


Public Sub Fortune()
    Dim msg As MailItem
    Dim item(1 To 3) As String
    item(1) = "a"
    item(2) = "b"
    item(3) = "c"
    Randomize
    Set msg = ActiveInspector.CurrentItem
    msg.body = item(Int((Rnd * 3) + 1)) & vbCrLf & msg.body
End Sub