Copilot for Microsoft 365 Tech Accelerator
Feb 28 2024 07:00 AM - Feb 29 2024 10:30 AM (PST)
Microsoft Tech Community

VBA Macro saving files as 0kb without the data in excel

Iron Contributor

Hi All,


I have a process which utilises VBA macro to extract excel files from microsoft outlook and save them in a folder with a specified file name. This process is used for a large number of files based on name, however I have noticed about half of the files get saved as a 0kb excel file. These files then have no data in them, so requires manual fix.


Investigation and trials to fix this has shown the issue is there is a macro which is currently being used to save file attachments sent to the specified inbox into the fileshare system at the moment the save function is saving files as 0KB into the folder which is causing the issue with dataflow. Additional information and troubleshooting done:

  • Inbox is running on outlook 2016 which is not outlook 365 the cloud version.
  • PST file has been repaired on outlook server
  • Attachments are able to open when opening through the email itself, therefore files that are being sent aren’t corrupted.
  • System resources have been increased to ensure that the issue isn’t stemming from low resources. Additionally a scheduled job to restart the server/automatically log into the mailbox has been created on the server.
  • I have sent a number of test emails to fund pricing inbox using ABC1 has been consistently failing.
    When sending these test emails I found that the process will save the attachment although having a low success rate. This means that it isn’t an issue permissions on the folder.

I was wondering if there are any potential solutions or updates to the macro which could help resolve this file saving issue, to help remove the daily manual intervention.


Greatly appreciate any supports or ideas.


Many thanks

1 Reply
If you want anyone to help, I advise to share (some of) your code.