Hi, sorry if I'm in the wrong place for this, but I've been trying to implement the advice in this article:
Here is the slightly altered code I'm using:
I know the author recommends using a stub-macro in order to get the rule to run, I'm just not quite sure where to implement that. Any help is appreciated!
Use VBA to move messages with attachments
Use a run a script rule or an ItemAdd macro to look for messages with attachments. When the attachment is a specific file type, do something with the message.
www.slipstick.com
Here is the slightly altered code I'm using:
Code:
Sub MoveMail(Item As Outlook.MailItem)
If Item.Attachments.Count > 0 Then
Dim attCount As Long
Dim strFile As String
Dim sFileType As String
attCount = Item.Attachments.Count
For i = attCount To 1 Step -1
strFile = Item.Attachments.Item(i).FileName
sFileType = LCase$(Right$(strFile, 4))
Select Case sFileType
Case ".xml"
' do something if the file types are found
' this code moves the message
Item.Move (Session.GetDefaultFolder(olFolderInbox).Folders("Test"))
' stop checking if a match is found and exit sub
GoTo endsub
End Select
Next i
End If
endsub:
Set Item = Nothing
End Sub
I know the author recommends using a stub-macro in order to get the rule to run, I'm just not quite sure where to implement that. Any help is appreciated!