+ Reply to Thread
Results 1 to 2 of 2

Thread: Identify .xls and .xlsm files only

  1. #1
    Registered User
    Join Date
    04-06-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    92

    Identify .xls and .xlsm files only

    Hi,

    I have a macro which goes to my outlook inbox and saved all attatchments. Is there a way to ammend the code to save only EXCEL files and ignore any other attatchements.

    Here is the section of code which saves the files:

     For Each Item In myfolder.Items
        For Each Atmt In Item.Attachments
           FileName = "H:\Emials\" & Atmt.FileName
           Atmt.SaveAsFile FileName
           i = i + 1
        Next Atmt
     Next Item
    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    Excel 2010
    Posts
    522

    Re: Identify .xls and .xlsm files only

    Not sure, but maybe
    Filename = "H:\Emials\" & Atmt.Filename
    If InStr(Filename, ".xls") Then Atmt.SaveAsFile Filename

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0