Outlook Macro Crashes on SaveAs

miller20817

New Member
Joined
Mar 5, 2014
Messages
3
Hi everyone. I have a macro that goes through a bunch of emails and saves them into my temp folder. Every now and then it hits an email that when it tries to save it as an mht file I get the error: "Microsoft Office Outlook A file error has occurred." Obviously not too helpful. Here is the code:

Item.SaveAs tmpFileName, olHTML

Item is an olMail item and tmpFileName is C:\Users\username\AppData\Local\Temp\fileName.mht.

Does anyone have any idea what might be the issue? As I said this only happens with certain emails. I can't seem to find any difference between the emails that work and those that don't.

Any ideas of where to look for a solution would be greatly appreciated. Thanks
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,215,363
Messages
6,124,505
Members
449,166
Latest member
hokjock

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