Unzip outlook attachments

Hi, I have the following code to save outlook attachments to a folder on arrival. But the attachments are zipped, and want the saved files to be unzipped. Any help much appreciated.
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "C:\Users\brendan\XML Files"
     For Each objAtt In itm.Attachments
          objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
          Set objAtt = Nothing
     Next
End Sub

Hi
As per the information and details provided by you, to unzip the Outlook attachments, please follow these steps: -
Sub UnzipAttachment(Item As Outlook.MailItem)
    Dim olkAttachment As Outlook.Attachment, _
        objShell As Object
    Set objShell = CreateObject("Wscript.Shell")
    If Item.Attachments.Count > 0 Then
        For Each olkAttachment In Item.Attachments
            If LCase(Right(olkAttachment.FileName, 4)) = ".zip"
Then
                olkAttachment.SaveAsFile "C:\EmailAttachments\"
& olkAttachment.FileName
                objShell.Run """C:\Program
Files\7-Zip\7z.exe"" e -aoa ""C:\EmailAttachments\" & olkAttachment.FileName & """"
            End If
        Next
    End If
    Set olkAttachment = Nothing
    Set objShell = Nothing
End Sub
I hope this information will be helpful for you.
Thanks and regards
Shweta@G 

Similar Messages

  • How to copy and paste outlook attachments between emails

    Hello
    Is there a way to copy and paste outlook attachments between emails instead of drag and drop? I`m a new Mac user, on windows I clicked on mouse and the option copy and paste was there... I don´t see this option on Mac.
    Thanks.

    Hi Hans,
    I can get a reference error here if the destination table does not have that range available while the source table does. 
    Are you sure your desination table has exactly the same structure and dimensions as your source table?
    If it does, copy/paste via the Formula Editor should work. It works reliably here.
    Also the formula in your latest post looks as if it might be corrupted-- lots of extra spaces (it seems).  Did your orginal formula have those?
    To sort this out, suggest turning off 'Use header names as labels' in Preferences.
    If you end up with a formula in a cell as just Text (as Ian describes that's what happens when you copy from Numbers 2) you can convert that text to a formula by double-clicking the cell, clicking just before the text so that the insertion point appears in front of it and typing =. That activates the Formula Editor with the formula in it, which you can accept by clicking the green checkmark or hitting return.
    SG

  • MSXML6 not supporting VB6 outlook.Attachments (MailItem.Attachments) getting ActiveX cannot create object error

    Hi, This is about msxml4 removal from my application for security reason.
    Currently in my application Outlook Addin with VB6 using Office2010 and outlook object is refering with MSOUTL.OLB from C:\Program Files\Microsoft Office\Office14
    When unregister MSXML4.dll to remove the dependacy of it and use MSXML6.dll, My application getting error.
    VB6 outlook.Attachments getting ActiveX cannot create object error
    if i register msxml4.dll again, then the same is working fine.
    Pls suggest how to remove msxml4 dependancy without this error
    Regards,
    Sathiya

    Firstly, you shouldn't be messing with the system dlls.
    Secondly, do you create an instance of the outlook.Attachments object (using "new" etc.)? That object cannot be created, you can only retrieve if from an Outlook item (e.g. MailItem.Attachments property).
    Please show the relevant snippet of your code.
    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

  • How do I Save Outlook Attachments using Powershell?

    I have seen a few examples of this for vbScript, but none for powershell.
    Here is a script I found to open Outlook and pick a folder:
    function Release-Ref ($ref) {
    ([System.Runtime.InteropServices.Marshal]::ReleaseComObject(
    [System.__ComObject]$ref) -gt 0)
    [System.GC]::Collect()
    [System.GC]::WaitForPendingFinalizers()
    $o = New-Object -comobject outlook.application
    $n = $o.GetNamespace("MAPI")
    $f = $n.PickFolder()
    Write-Host $f.name
    $a = Release-Ref($f)
    $a = Release-Ref($n)
    $a = Release-Ref($o)
    Now I want to save the Excel attachments in the folder I pick.
    Better yet, I want to Open the attachements in Excel and copy the contents to a master spreadsheet.
    Again, I found a vbScript in "Hey Scripting Guy" BUT, The format is so mangled, I can not read the script.
    Anyone else have that problem? The scripts come out as one long line of text.

    because you didn�??t filter out emails without attachments so the first email it comes to in that box doesn�??t have one, and the value is null, and fails.
    in that script, where $a = $f.items, that�??s just assigning all emails because $f is the folder and .items is all items in that folder.
    so that item may not have an attachment, hence the null error
    I think you can do
    foreach ($item
    in
    $f.items)
    $sender
    =
    $item.SenderName
    foreach($attach
    in
    $item.Attachments)
    if($attach.filename.contains("xlsx"))
    write-host
    "$sender sent $($attach.filename)"
    I did this on my inbox and for the most part it worked. I would some times get the error you got and I cant figure out why. In testing I found that it identified that it had attachments when it didn�??t.

  • Programmatically save O365 Outlook attachments to either OneDrive or a local file system

    .csv files are emailed as attachments every 15 minutes to an Outlook email account in Office 365.  I would like to save each of these .csv files to a folder on either One Drive or to a folder on a local file system.  How can this be accomplished
    through PowerShell?

    > Why would you think that it can't be done?
    I didn't say so. A different technology should be used in case of OWA (EWS) which is a subject for another forum.
    You keep posting about OWA.  OWA is not a factor here.  EWS is NOT OWA.  EWS works with Exchange 2007 and later.  O365 is Exchange 2013.  OWA is a SharePoint application that runs on SharePoint and makes Exchange visible in a Web
    Browser.  EWS does not require OWA or SharePoint.
    I know all of this is very confusing but once sorted it is quite obvious what each pieces is and how they are related.  O365 is just Exchange/AD/IIS on the Azure platform (or a customized version of it)  with some added bells and whistles.
    We have had the same access over time with MSN and Hotmail.  Now all are on full Exchange.  I have systems that have Office installed from MSN as a subscription.  All have VBA and all work either on  the desktop or on the web.  We
    can switch between web and desktop seamlessly.  O465 also has added live collaboration so we can co-edit Word and Excel documents.  Amazingly VBA and Net continue to work across all products.  Of course the new effort is always from and towards
    Net.  All new tools are being built in PowerShell.
    So it is time to get out of the old 20th century sneaker-net version of Windows and get you head in the clouds. ...
    I know. Your mother said "Eugene! Get you head out of the clouds."  but in this century mothers everywhere are saying "Eugene! Get your head into The Cloud if you want to be a success."
    The Cloud is mostly just a way of thinking.  Same hardware and same software.  It just sits on a bigger network.
    ¯\_(ツ)_/¯

  • Transfering from Outlook / Attachments

    Hey,
    Does anyone know of an efficient way of transfering mails from Outlook to Mac mail? I've tried sending them in attachments but Mac mail puts all attachments in the email message body. If you know of a way to have mail keep attachments as suck and not in the email body that would be great as well!
    Txs

    lisamwood3,
    Not sure what you mean by "opening so large", perhaps you could provide more details?

  • Default save file location ignored for Outlook attachments

    Whenever I open an office attachment in Outlook, then edit and try to save, it always goes to "Libraries/Documents". I then have to do numerous clicks to get to my default location for every file.
    Is there somewhere to set the default for this. The "default file location" in Excel or Word are ignored.
    Thanks, Joe

    Try this:
    Open the Registry Editor (regedit) and browse to the following registry key:
    HKEY_CURRENT USER\Software\Microsoft\Office\15.0\Outlook\Options
    Create a new String value called "DefaultPath" in the right pane, modify the entry to the locate as you want.
    Another thread with the same topic for your reference:
    http://answers.microsoft.com/en-us/windows/forum/windows_7-files/default-save-location-does-it-have-to-be-a-library/11ee9557-78ba-4236-8200-ee4961f881ee
    Thanks.
    Tony Chen
    TechNet Community Support

  • Outlook, attachments and Mail

    For "safety' reasons, people who use outlook send their message as an attachment. The problem is when there is also an attachment. I can read the message that's the attachment, but for some reason the actual attachment does not appear. I have also tried TNEF's Enough, but that doesn't get the actual attachment. Any thoughts?

    Resolved after server readjustment

  • Outlook attachments

    When attaching a Word document to an email it won't let user open the document to double check it. It just opens a new Word document instead. Has anyone experienced this before?

    Hi,
    I tested on Outlook 2007, Outlook 2010 and Outlook 2013, but couldn't reproduce this issue.
    We can do some troubleshooting steps on this, first please run Outlook in Safe Mode, test if this issue persists when you add a new Word document:
    Press Win + R and type “outlook.exe /safe” in the blank box, then press Enter.
    If there’s no problem in Safe Mode, disable the suspicious add-ins to verify which add-ins caused this issue.
    If it turns out not related to Outlook add-ins, you can also open Word, disable suspicious add-ins first, then go to Outlook to try again.
    This article helps you understand how to disable add-ins in Office:
    http://www.extendoffice.com/documents/office/489-office-2010-add-ins-managerhow-to-addremove-add-ins.html
    Regards,
    Melon Chen
    TechNet Community Support

  • HELP!! Using a vba script in Outlook to copy attachments to c:\temp folders automatically

    Hi
    I'm brand new to Visual Basic really - you will be able to tell that I am a complete beginner. I wouldn't be posting here but I had tried asking other Forums but have not got any responses.
    This is the problem:- I've found a basic VB script to copy attachments within Outlook 2000 Inbox to the c:temp folder when a new email arrives in. When I debug the script in Outlook > Tools > Macros , it just seems to loop round and round within the
    top function called Application_Startup () and never attempts the objInbox_ItemAdd() function which is the important part. Please can anyone say what is wrong.
    I'm putting all this code within Project1 > Microsoft Outlook Objects > This OutlookSession - I bet I'm putting all this code in the wrong place aren't I? Please help anyone.
    Dim WithEvents objInbox As Outlook.Items
    Private Sub Application_Startup()
    Set objInbox = Session.GetDefaultFolder(olFolderInbox).Items
    End Sub
    Private Sub objInbox_ItemAdd(ByVal Item As Object)
    If Item.Class = olMail Then
    If Item.Attachments.Count > 0 Then
    Dim objAttachments As Outlook.Attachments
    Set objAttachments = Item.Attachments
    For Each objAttach In objAttachments
    ' Does not handle duplicate filename scenarios
    objAttach.SaveAsFile "C:\temp" & objAttach.FileName
    Next
    Set objAttachments = Nothing
    End If
    End If
    End Sub
    Also, I've set the Security to Low within Outlook > Tools> Macros > Security and a bit baffled why this won't run.
    Just for info, I got this VBScript solution from:-
    Outlook Visual Basic for Applications Rules
    Kind Regards
    Matt
    p.s I'm stuck with Outlook 2000 due to a limitation with some Legacy software that my company is still using.

    Thanks jrv.
    At the moment - I don't have the time to learn VBA better along with learning the other things I have an intested in already (e.g. PowerScript) - My customer has an outstanding fault which need fixing urgently. I've spent about 5 hours so fa trying to get
    a VBA script to work withing Outlook but to no avail. I might ask around my company to see if any one else can help or post this on a non-Microsoft forum I think.
    Cheers all the same
    Matt
    So you sold a job to do something you do not knowhow to do.  You are getting paid.  It is your job to learn or to hire someone with the skills you have sold.  We cannot produce custom scripts for an obsolete version of Outlook 2000.. 
    O2000 is almost 15 years old. It is not secure as no security patches have been released for it for almost 10 years.  It is old technology which none of us care to remember unless you want to pay us for the assistance.
    Here is the link to the instructions in th KB that you completely ignored:
    http://support.microsoft.com/kb/235852/EN-US
    It shows you exactly how to do this in Outlook 2000.  You must read all of the instructions carefully.  YOu must try all example code and be sure you understand how it works.  Post all issues with how to use VBA in the Outlook VBA developers
    forum AFTER you have tried that code and have a specific question and not just a requirement for someone to fix this for you.
    The code in the article is explicit to Outlook 2000.  The code you are using is only usable in Outlook 2002 and later.,  You must follow the examples for Outlook 2000 as outlined in your original article.
    If you want to be a technician you need to learn all of these things.  Just knowing how to install a PC is not sufficient if you are going to be a contractor.
    VBA is VBA.  Posting here will not change that.  This is an Admin scarping forum and not an office VBA forum.  VBA is NOT VBScript.  No matter how much it looks like VBScript it is not.
    You cannot just copy VBScript into a VBA module and expect it to work. 
    You have sold the job of a programmer and Outlook developer with no skills in that area.  Is that fair to your customer?
    There are hundreds of skilled developers who have spent good money and time learning to do these things. You cannot just past some things you found on the Internet into a file and ask someone to fix it for you. 
    Start by learning the difference between script and VB.  Next you need to learn what an event is and how it is generated.  The code you posted does nothing in Outlook because it is not Outlook code.
    No.  I am not picking on you.  I am trying to get you to wake up and spend time learning your profession.  It is a lot of fun and actually pretty easy but only if you do your homework.
    ¯\_(ツ)_/¯

  • Cannot save attachments from outlook to My Documents.

    At the company i worked for, there is a problem with saving attachments from Outlook in to My Documents.
    Info:
    Outlook 2010
    Exchange Server 2007 (CCR Cluster 1 HUB and 2 MBX)
    Redirected My Documents
    File Cluster (Windows Server 2003 Ent)
    All the people using Outlook working at the company can’t save their outlook attachments to the My Documents
    (which is relocated to the homedir folder on the file cluster )
    anymore. 
    The strange part here is, that the attachments are saved to that location. Only a notification pop-ups in outlook
    and says, that the attachment can’t be saved.
    L
    When i open the My Documents and tried to save something, there is no problem.
    The problem occured spontaneously,
    we can’t find
    a solution to fix it.
    On the file cluster the security rights on the profile
    and homefolder are
    correct, nothing changed.
    Yesterday I updated both Exchange nodes and did a failover and rebooted the passive node.
    The problem still exists,  when people tried to save there attachment into My Documents it keeps popping op.
    When the people save there attachment on the Desktop, than there is no warning.
    Sorry for my bad English, hopefully someone can help me.
    Kind Regards,
    Arie   

    Hi,
    This issue can be caused by Protected View settings in Office prevent saving E-mail Attachments. Please try the following steps to check this issue:
    Open an Office product such as Excel.
    Choose File > Options > Trust Center
    Click “Trust Center Settings” Button
    Choose Protected View in left side selection pane.
    Check appropriate check boxes for Protected View settings.
    Click OK > OK.
    Close and Open Outlook.
    If this issue persists, please let me know.
    Best Regards.

  • MS Office attachments won't open from external sources in Office 2013

    I have a client who is having an issue with MS Office attachments (.docx, .xlsx, .pptx) not opening.  The error message is "[Office program] experienced an error trying to open the file".  This is Office Pro Plus 2013 (no SP) on Win 7
    SP1 x64. There are users on same OS with Office 2007 SP3 that are able to open attachments without issue.
    I've tracked the issue down to Protected View.  I've also found the acceptable answer for just about everyone that's asked is to uncheck or remove the Group Policy for "Enable Protected View for files originating from the Internet" and/or
    "Enable Protected View for Outlook attachments". 
    Unfortunatey, due to the environment that it's in, I am unable to make that change.  Does anyone know of an actual fix or workaround separate to this?
    Thanks,
    Kiel

    Hi Kiel,
    Probably, you can find the location of those files, then add it to the
    Trusted Locations of any Office applications:
    FILE>Options>Trust Center>Trust Center Settings...>Trusted Locations>Add new location... button
    (usually, the error message dialog contains the source location of those files.)
    Regards,
    Ethan Hua
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Empty PDF in IE after opening FDF directly from Outlook

    Hi,
    im currently facing a old/known problem and i found no optimal solution for it.
    One of our clients migrated from XP to Win7 and since that the opening of a FDF-file from Outlook only opens the empty PDF in IE (Internet Explorer).
    (I found the problem in this forum, but no solution: "FDF file not opening in IE 8 with Adobe reader 9 or Adobe pro 9" - http://forums.adobe.com/message/3753591#3753591 )
    I did some investigation and found, that the problem seems to be the Folder "C:\Users\MYUSER\AppData\Local\Microsoft\Windows\Temporary Internet Files", where Outlook saves the FDF-file temporarily to open it with IE. (this folder is a Windows-'Systemfolder', the FDF-file can be found in a hidden subfolder 'Content.Outlook\????????\' (??..?? are various alphanumeric chars))
    If you browse to that folder and opens the FDF manually it shows the same behaviour (only empty PDF) as opened with Outlook.
    If you copy the FDF out of the 'Temporary Internet Files' eg. to 'C:\Users\MYUSER\AppData\Local\Microsoft\Windows\' or Desktop and then opens the FDF the PDF will be opened correctly filled within IE.
    After playing a lot with IEs Security-Settings i found that disabling the 'protected mode' for the 'Internet'-zone solves the problem and PDFs get opened filled, but for security reasons this is not an option (IE warns on disabling 'protected mode' that's a risk for your computer).
    Another way I found was using another temp-path for Outlook-attachments - defined by registry-key 'HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Security\OutlookSecureTempFolde r'  - eg. 'C:\temp' (our client is currently evaluating this solution - it's also not perfect for security reasons)
    Any other ideas to solve this problem (except my initially one - using Firefox ;-) - i think Firefox is a perfect solution, but sadly not accepted by the client)?
    thanks

    I hate to bring up an old post, but I also have the same issue.  We also found that disabling the UAC solved the issue, but is not an acceptable solution for our client either.
    I went on MS forum asking what the UAC might be doing and was told to come ask the Adobe forums (how convenient)
    So if anyone has found anything on this subject, I'm all ears!

  • MailItem.SaveAs doesn't save attachments?

    When I drag over an outlook message to a folder on my computer, it will save the email "*.msg" file and embedded in the email are the attachments. 
    Why doesn't the MailItem.SaveAs() method do the same thing? Is there something different I need to do to embed the attachments just as if I were dragging the email over as a MSG file?
    I appreciate the help in advanced.
    neech
    neech

    Hello neech,
    You need to iterate over all
    Attachments and use the
    SaveAsFile method which saves the attachment to the specified path.
    Sub SaveAttachment()
    Dim myInspector As Outlook.Inspector
    Dim myItem As Outlook.MailItem
    Dim myAttachments As Outlook.Attachments
    Set myInspector = Application.ActiveInspector
    If Not TypeName(myInspector) = "Nothing" Then
    If TypeName(myInspector.CurrentItem) = "MailItem" Then
    Set myItem = myInspector.CurrentItem
    Set myAttachments = myItem.Attachments
    'Prompt the user for confirmation
    Dim strPrompt As String
    strPrompt = "Are you sure you want to save the first attachment in the current item to the Documents folder? If a file with the same name already exists in the destination folder, it will be overwritten with this copy of the file."
    If MsgBox(strPrompt, vbYesNo + vbQuestion) = vbYes Then
    myAttachments.Item(1).SaveAsFile Environ("HOMEPATH") & "\My Documents\" & _
    myAttachments.Item(1).DisplayName
    End If
    Else
    MsgBox "The item is of the wrong type."
    End If
    End If
    End Sub

  • Unzip email attachment file

    Does OS Xv10.5 have a built in utility for unzipping email attachments? If so how do you use it? My email program is yahoo.

    Try the free Stuffit Expander You have the option to set it to automatically unstuff files when you download them or if left still stuffed/zipped then just double click the compressed file to extract it.

Maybe you are looking for

  • Single item having content type property set for both GIF and JPEGs

    Is it possible to have a single blob column in the database that stores either jpegs or gif files and then the ability to display either type through a hyperdrill on a Discoverer item? If so, how can the content type property on an blob item be set t

  • Is it possible in Workflow to auto-forward messagefrom SAPinbox to Outlook

    Hi Experts, In my workflow, previously I included a send mail step that sends notification message to holders of a position id in their SAP business workplace inbox. Then an activity step was there to determine the Outlook email addresses of those us

  • Are you allowed to do this?

    Ok let's say in my case my computer is going through the Kernal Virus. Would I be allowed to connect my ipod to another computer with ipod software installed? If so I heard this was against the law and if so I don't see how it would. If not would it

  • How to add currency sign?

    Hi, I have a group currency key figure in my report. I want to add $ sign in front of the amount for ex. 12550 it should show as $12550. How to add currency sign $ in front of the aount. Pts for ans. Regards, Shri.

  • MSS iview modification

    Hello, I have downloaded a par file related to Personal Data(com.sap.pct.hcm.eeprofilepersonaldata.par) and chnaged the name to com.mycompany.pct.hcm.eeprofilepersonaldata.par imported to Developer Studio and commented some code. I created a par file