reubendayal
Senior Member
- Outlook version
- Outlook 365 64 bit
- Email Account
- Office 365 Exchange
Hi All,
I work with several cases that are subfolders under 2 different shared mailboxes. When replying to an email on a specific case, I need to move it to the case folder, and then reply to it (so the reply gets saved in the same folder). So I am trying to find a faster way of doing this.
The problem is the step with putting together a macro that can list all the sub folders from the two shared mailboxes. What I need help with is (to describe in a chronological manner):
I work with several cases that are subfolders under 2 different shared mailboxes. When replying to an email on a specific case, I need to move it to the case folder, and then reply to it (so the reply gets saved in the same folder). So I am trying to find a faster way of doing this.
The problem is the step with putting together a macro that can list all the sub folders from the two shared mailboxes. What I need help with is (to describe in a chronological manner):
- once I have selected an email/s in the inbox, i call the macro by a keyboard shortcut,
- the macro then displays a list of folders from the two shared mailboxes, and i just need to type the case folder name's first or second characters for the combobox to select it, and then hit okay,
- the macro then selects the path of the case folder, and moves the email/s I had selected to the subfolder's path
- it then selects the sub folder as the active folder and ReplyAll to the email that was just moved (else replyall to the latest of the emails that were moved)
Code:
Sub InitiationMoveEmail_GotoFolder()
Dim objNS As Outlook.NameSpace
Dim objDestFolder As Outlook.MAPIFolder
Dim objItem As Outlook.MailItem
Set objNS = Application.GetNamespace("MAPI")
' Pick the destination folders
Set objDestFolder = objNS.PickFolder
If Not (objDestFolder Is Nothing) Then
Set objItem = Application.ActiveExplorer.Selection.Item(1)
For Each objItem In ActiveExplorer.Selection
objItem.Move objDestFolder
Next
Set Application.ActiveExplorer.CurrentFolder = objDestFolder
Else
MsgBox "Outlook Folder is not created!", vbOKOnly + vbCritical, "Exiting Automation"
Exit Sub
End If
Set objDestFolder = Nothing
Set objNS = Nothing
End Sub