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!!
 
Google "outlook vba saveas run-time error 287".

It seems to be related to security policies for Outlook.

Try saving an email (as Outlook Message Format) in that folder.
I am able to save emails manually into that folder
1656084431111.png
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
One Google result is:


Click the link in the answer and this is possibly the cause of your error:

Configure a prompt when a program uses the Outlook object model to access the Save As command to save an item​


This policy determines the behavior that occurs when a program uses the Outlook object model to access the Save As command to save an item.


Key: HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Security
DWORD value: PromptOOMSaveAs
Values:
  • 0: Automatically deny
  • 1: Prompt user
    Note
    This is the default setting.
  • 2: Automatically approve
 
Upvote 0
One Google result is:


Click the link in the answer and this is possibly the cause of your error:
That probably is it. I will get with our Admins to see if this is something we can change. Thank you for all of your help!!
 
Upvote 0
I highly doubt I would be able to get the registry edited for myself on this. Wonder if there would be a way to prompt to save versus saving automatically? Like pick a location and then save. By omitting the SaveAs, would that eliminate the problem?
 
Upvote 0
Replace the SaveAs with:
VBA Code:
            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
 
Upvote 0
Replace the SaveAs with:
VBA Code:
            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
Seemed to work perfectly, got the message box advising the number of emails saved to the folder, but when I checked the folder, there was none there.
 
Upvote 0
Delete that message because the code doesn't know how many emails you saved.
Will do, I'm a bit confused though. There was one email in the inbox that met the criteria. The message says it saved the one email (provided all the details for the email) but it did not actually save it. Shouldn't it have saved it?
 
Upvote 0
No, the code doesn't save it because the SaveAs causes an error on your machine and therefore it has been replaced by a prompt for you to manually save the email (that's what you asked for). So you have to manually click File -> Save As in Outlook and save the email yourself. You then click OK on the message and the code finds and selects the next email and prompts you to save that email, repeating until all matching emails have been found and you manually save each one (or not, as you choose) or you click Cancel in the message to quit the macro.
 
Upvote 0
No, the code doesn't save it because the SaveAs causes an error on your machine and therefore it has been replaced by a prompt for you to manually save the email (that's what you asked for). So you have to manually click File -> Save As in Outlook and save the email yourself. You then click OK on the message and the code finds and selects the next email and prompts you to save that email, repeating until all matching emails have been found and you manually save each one (or not, as you choose) or you click Cancel in the message to quit the macro.
OH! I see. I didn't realize it would work email by email. I was thinking it would be done in bulk. Would that be a possibility?
 
Upvote 0

Forum statistics

Threads
1,216,071
Messages
6,128,623
Members
449,460
Latest member
jgharbawi

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