Forum Discussion
Sameer_Kuppanath_Sultan
Nov 24, 2020Copper Contributor
VBA - Moving a mail from inbox to a specific folder
Hi every One, greetings
I have to do the following.
I need a vba for, moving a mail in outlook inbox to a specified folder in outlook based on either Sender name or sender mail or mail subject, commanding from excel.
I have browsed for this all over internet, and found only outlook VBAs, which I think it will create security issues. ..
Could any "Master Minds in VBA" help on this????
21 Replies
Sort By
- NikolinoDEGold Contributor
Maybe this approach could help you resolve your issue.
Please adjust in your code
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) If TypeOf Item Is Outlook.MailItem Then SaveSentMail Item End If End Sub Private Sub SaveSentMail(Item As Outlook.MailItem) Dim Inbox As Outlook.MAPIFolder Dim Subfolder As Outlook.MAPIFolder If Item = "Nikolino" Then Set Inbox = Application.Session.GetDefaultFolder(5) Set Subfolder = Inbox.folders("0200 Nikolino").folders("General") Set Item.SaveSentMessageFolder = Subfolder End If
Sorry that I haven't been able to offer you a quick, acceptable solution until now.
Will keep you updated
Thank you for your patience and time.
Nikolino
I know I don't know anything (Socrates)
- Sameer_Kuppanath_SultanCopper Contributor
- NikolinoDEGold Contributorits for Excel
- Sameer_Kuppanath_SultanCopper Contributor
Hey Master Minds
Please help me on this.
Just to describe again,
I have attached the code herewith-please find it.
this code will help me to save the attachment from outlook to a specific folder in my PC.
What I need is, to move the selected mail in outlook inbox to a folder in outlook after clicking this VBA.
So ultimately, I will save the attachment and will move this mail to a folder in outlook. so no mails inbox to attend!!!!
- NikolinoDEGold Contributor
I think that this will solve your problem.
MailItem.Move method (Outlook)
https://docs.microsoft.com/en-us/office/vba/api/outlook.mailitem.move
Thank you for your understanding and patience
Wish you a nice day.
Nikolino
I know I don't know anything (Socrates)
- Sameer_Kuppanath_SultanCopper Contributor
I tried that, but showing the below screen shot and yellow highlighted the code below.
Please note: I did it in Excel VBA
- NikolinoDEGold Contributor
I cannot follow your plan, probably from the translation.
It would be beneficial if you insert a file (without sensitive data), if necessary, and explain your plans on the basis of this file.
An additional advantage of getting a quick and precise solution proposal here is if you would send us your Excel version and your operating system.
Nonetheless, yesterday I had a topic that was similar, attached the file that I sent, maybe it fits into your plan.
I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.
- Sameer_Kuppanath_SultanCopper Contributor
NikolinoDE Hi- Thanks for coming up for helping me.
I have attached the code herewith-please find it.
this code will help me to save the attachment from outlook to a specific folder in my PC.
What I need is, to move the mail in outlook inbox to a folder in outlook after clicking this VBA.
So ultimately, I will save the attachment and will move this to a folder in outlook. so no open files inbox to attend!!!!