Ryzon9
07-11-2015, 04:03 PM
Hello!
I am trying to create a macro that after a user hits send message, the macro searches the attachments (Excel, Word, PDF). If it finds what it is looking for, a message box pops up warning the user. The user can choose to send anyway or cancel. If nothing is found the email is sent.
So I've decided to use this to start off:
Public Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)
This is the message box part which works great. Gives the message box and allows the user to proceed. The Search is the result from the cycling (below).
If Search = True Then
If MsgBox(msg, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Attachment Check") = vbNo Then
Cancel = True
End If
The part I'm struggling with is cycling through each attachment and then calling the respective search sub based on its file type.
Is there a way to do this without saving all the attachments to a temporary folder or is that the only way?
What I would like to be able to do is the following:
For each attachment
If the file type is:
Excel, call SearchExcel
Word, call SearchWord
Pdf call SearchPdf
End If
Loop
Thanks!!!
I am trying to create a macro that after a user hits send message, the macro searches the attachments (Excel, Word, PDF). If it finds what it is looking for, a message box pops up warning the user. The user can choose to send anyway or cancel. If nothing is found the email is sent.
So I've decided to use this to start off:
Public Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)
This is the message box part which works great. Gives the message box and allows the user to proceed. The Search is the result from the cycling (below).
If Search = True Then
If MsgBox(msg, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Attachment Check") = vbNo Then
Cancel = True
End If
The part I'm struggling with is cycling through each attachment and then calling the respective search sub based on its file type.
Is there a way to do this without saving all the attachments to a temporary folder or is that the only way?
What I would like to be able to do is the following:
For each attachment
If the file type is:
Excel, call SearchExcel
Word, call SearchWord
Pdf call SearchPdf
End If
Loop
Thanks!!!