Greetings,
I found this code online and it's not working for me (Outlook 2016)
I have set all macros to allow in the trust center and inserted the code inside Developer-visual basic-this outlook session.
Would someone be so kind and tell me if I’m doing it wrong or is there some thing wrong with the code.
Bonus question: If I would like to add multiple “key words” do I separate them with -> ;
Best regards
I found this code online and it's not working for me (Outlook 2016)
I have set all macros to allow in the trust center and inserted the code inside Developer-visual basic-this outlook session.
Code:
' Declare a variable to save the body content.
Dim strBody As String
' Conver the body content to lowercase.
strBody = LCase(Item.Body)
' /* Check if the body contains the keyword "attach". */
If Not strBody Like "*attach*" Then
Exit Sub
End If
' /* Check the number of attachment(s). */
If Item.Attachments.Count = 0 Then
MsgBox "No Attachment currently.", vbExclamation, "Message"
cancel = True
End If
End Sub
Would someone be so kind and tell me if I’m doing it wrong or is there some thing wrong with the code.
Bonus question: If I would like to add multiple “key words” do I separate them with -> ;
Best regards