How to instruct Outlook to save unzipped file?

Adar123

New Member
Joined
Apr 1, 2018
Messages
43
Office Version
2013, 2010
Platform
Windows
Hello everyone,

I have a macro in Outlook that instructs the file to be downloaded and saved under a specified name format. The challenge I am facing is that it is a .zip file with an Excel document inside. Eventually I need to get hold of the Excel file inside. How do I instruct the outlook to unzip the file and then save its contents under a specified name. Thank you.

VBA Code:
Public Sub SaveAutoAttach(item As Outlook.MailItem)
Dim object_attachment As Outlook.Attachment
Dim saveFolder As String
'Folder location
saveFolder = "H:\MyFile_" & Format(item.ReceivedTime, "yyyymmdd") & ".zip"
For Each object_attachment In item.Attachments
object_attachment.SaveAsFile saveFolder
Next
End Sub
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Watch MrExcel Video

Forum statistics

Threads
1,102,351
Messages
5,486,358
Members
407,541
Latest member
Emilybuhman

This Week's Hot Topics

Top