제목 줄에 특정 단어가 포함된 이메일을 전달하는 Outlook VBA 만들기

제목 줄에 특정 단어가 포함된 이메일을 전달하는 Outlook VBA 만들기

안녕하세요. Outlook에서 제목 줄에 어떤 순서로든 3개의 특정 단어가 있는 규칙이나 VBA를 만들고 싶습니다. 예를 들어 '배지, 사용자, 오토바이'를 찾고 싶습니다.

대상의 말: 배지와 오토바이를 탄 사용자.

제목에 이 세 단어가 포함되어 있으면 이메일을 누군가에게 전달하고 싶습니다.

"mark-goldfain"이 만든 이 코드를 찾았는데, 수정할 수 있을까요? VBA 프로그래밍에 대해서는 아무것도 모르지만.

Public Sub File_Stock_Incoming_Message(Item As Outlook.MailItem)
  ' This macro is called from a wizard-built rule, where the
  ' rule operates on *every* incoming message, and its action
  ' is to call this macro.
  Dim NS As Outlook.NameSpace
  Set NS = Application.Session
  Dim MoveToFolder As Outlook.MAPIFolder
  Set MoveToFolder = NS.Folders("mainboxname").Folders("MsgLog")

  Dim sbjstr As String
  sbjstr = Item.Subject
  If (sbjstr = "Whatever Site Error") Then
    Item.Move MoveToFolder
  End If
End Sub

답변1

다음의 조건을 변경하면 됩니다 If.

instr(item.subject,"word1")>0 And instr(item.subject,"word2")>0 And instr(item.subject,"word3")>0

관련 정보