2011-03-08
Outlookのメール受信時に自動で件名のtab文字を除去するマクロ
Outlook2007でメール受信時に自動で起動し、件名(Subject)に含まれるtab文字を除去するVBAマクロのサンプル。
Visual Basic Editorを起動し、プロジェクトエクスプローラにある「ThisOutlookSession」に、以下のコードを貼り付ける。
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim v As Variant
Dim oMsg As Object
Dim sSubject As String
For Each v In Split(EntryIDCollection, ",")
Set oMsg = Application.Session.GetItemFromID(v)
sSubject = oMsg.Subject
If InStr(1, sSubject, vbTab) > 0 Then
With oMsg
.Subject = Replace(sSubject, vbTab, "")
.Close olSave
End With
End If
Next
End Sub
トラックバック - http://d.hatena.ne.jp/deck-no-bow/20110308/1299511750
