If I understand you correctly, you're trying to remove .png files being sent to SpiceWorks. If so, use the macro below from the Outlook mailbox sending to SpiceWorks. On the ItemSend
event, this will check the filename of all attachments and remove those with .png extensions. If this is not what you're trying to do, post back here. Thanks.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'if attachments are there
If Item.Attachments.count > 0 Then
'for all attachments
For i = Item.Attachments.count To 1 Step -1
'if the attachment's extension is .png, remove
If Right(Item.Attachments(i).FileName, 4) = ".png" Then
Item.Attachments.Remove (i)
End If
Next
End If
End Sub
----- updated to only remove attachments that look like "image###.png" -----
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'if attachments are there
If Item.Attachments.count > 0 Then
'for all attachments
For i = Item.Attachments.count To 1 Step -1
'if the attachment's filename is similar to "image###.png", remove
If InStr(Item.Attachments(i).FileName, "image") > 0 And Right(Item.Attachments(i).FileName, 4) = ".png" Then
Item.Attachments.Remove (i)
End If
Next
End If
End Sub
----- updated to only remove attachments that are <10kb and look like "image###.png"-----
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'if attachments are there
If Item.Attachments.count > 0 Then
'for all attachments
For i = Item.Attachments.count To 1 Step -1
'if attachment size is less than 10kb
If Item.Attachments(i).Size < 10000 Then
'if the attachment's filename is similar to "image###.png", remove
If InStr(Item.Attachments(i).FileName, "image") > 0 And Right(Item.Attachments(i).FileName, 4) = ".png" Then
Item.Attachments.Remove (i)
End If
End If
Next
End If
End Sub