Saving Emails from specific sender to folder on hard drive

Holley

Board Regular
Joined
Dec 11, 2019
Messages
120
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello all and many thanks for past help. Reaching out once again because I am trying to create an Excel spreadsheet that will allow me to create a button that will allow me a way to save all the emails in the inbox from a specific sender (vendor@abc.com) - this is a shared mailbox- to a folder on a shared hard drive (P:\responses) I would like to create a subfolder with the current date and have the emails saved there. Access to creating and running macros is disabled within Outlook, but we can use them in Excel. Any assistance would be most appreciated in tackling this. Thanks again in advance!!
 
I was thinking it would be done in bulk. Would that be a possibility?
Have you tried selecting multiple emails and saving them? The only Save As option is Text Only.

I just noticed that there two lines missing from my previous change which selects each email in turn and prompts you to save the currently selected email. The loop should be:

VBA Code:
    Set outItems = outFolder.Items.Restrict(filter)
    For Each outItem In outItems
        If outItem.Class = OlObjectClass.olMail Then
            Set outMailItem = outItem
            ActiveExplorer.ClearSelection
            ActiveExplorer.AddToSelection outMailItem
            If MsgBox(outMailItem.Subject & vbCrLf & vbCrLf & "'Save As' the currently selected email, then click OK to continue or Cancel to quit this macro", _
                vbOKCancel + vbInformation, Title:="Save This Email?") = vbCancel Then Exit Sub
        End If
    Next
If you want to save multiple emails in bulk then move
VBA Code:
ActiveExplorer.ClearSelection
above the For ... Next loop and the MsgBox prompt below the loop, changing the prompt to suit.
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Just getting a chance to work on this again... I am getting a prompt, but OK is my only option. When I click OK, it tells me no emails were saved.
1656617253420.png
1656617297860.png
 
Upvote 0
I am getting a prompt, but OK is my only option.
No, the options are OK and Cancel.

When I click OK, it tells me no emails were saved.
I told you to delete the final MsgBox statement because it only applies when the code is saving the emails with the SaveAs line and it knows how many emails were saved.

Since you're now saving the emails manually it doesn't know how many you saved.

As I previously explained, when the 'Save This Email?' prompt appears you're meant to save the email manually and then click OK for the next email or click Cancel to quit the macro.
 
Upvote 0
I told you to delete the final MsgBox statement because it only applies when the code is saving the emails with the SaveAs line and it knows how many emails were saved.
Oh, I completely misunderstood.

As I previously explained, when the 'Save This Email?' prompt appears you're meant to save the email manually and then click OK for the next email or click Cancel to quit the macro.
I understand now. I was under the impression it would generate a prompt for me to add location I wanted to save the files in. Thank you for clarifying.
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,572
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top