Hi
I have a script looking for a specific attachment name then forwarding it to a new recipient. Once this mail is sent it then has to move the original mail into a sub folder under the inbox.
This works when using it on my primary email account but I need this to run on a secondary account.
here is the code i have thus far please assist would be greatly appreciated.
Sub RequestForm(olItem As MailItem)
Dim olAtt As Attachment, ol_newmail As MailItem
For Each olAtt In olItem.Attachments
If InStr(1, Left(olAtt.FileName, 8), "FileName") > 0 Then
Set ol_newmail = olItem.Forward
ol_newmail.To = "newrecipient@email.com"
ol_newmail.Send
Exit Sub
End If
Next
End Sub
Sub MoveForm(Item As Outlook.MailItem)
For Each olkAtt In Item.Attachments
If Left(LCase(olkAtt.FileName), 8) = "filename" Then
Item.Move Session.GetDefaultFolder(olFolderInbox).Folders("DistinationFolder")
Exit For
End If
Next
Set olkAtt = Nothing
End Sub
Im assuming this is because I am using default folder but cant i just add the email account name somewhere within the Item.Move command
I have a script looking for a specific attachment name then forwarding it to a new recipient. Once this mail is sent it then has to move the original mail into a sub folder under the inbox.
This works when using it on my primary email account but I need this to run on a secondary account.
here is the code i have thus far please assist would be greatly appreciated.
Sub RequestForm(olItem As MailItem)
Dim olAtt As Attachment, ol_newmail As MailItem
For Each olAtt In olItem.Attachments
If InStr(1, Left(olAtt.FileName, 8), "FileName") > 0 Then
Set ol_newmail = olItem.Forward
ol_newmail.To = "newrecipient@email.com"
ol_newmail.Send
Exit Sub
End If
Next
End Sub
Sub MoveForm(Item As Outlook.MailItem)
For Each olkAtt In Item.Attachments
If Left(LCase(olkAtt.FileName), 8) = "filename" Then
Item.Move Session.GetDefaultFolder(olFolderInbox).Folders("DistinationFolder")
Exit For
End If
Next
Set olkAtt = Nothing
End Sub
Im assuming this is because I am using default folder but cant i just add the email account name somewhere within the Item.Move command