Consulting

Results 1 to 3 of 3

Thread: Saving attachments greater then 200 KB

  1. #1
    VBAX Newbie
    Joined
    Sep 2014
    Posts
    2
    Location

    Saving attachments greater then 200 KB

    Hi all,

    I'm trying to save an attachment to my computer automatically from mails that i recive everday. Code that i use is below. If mail body has a image in the signature part, vba selects that image first as attechment, renames and saves it. But that file is not the one i m looking for (i need excel file). The excel files size is always greater than 200 kb so i thought if i can choose attechment greater than 200, vba can save attachment that i want. I'm using filelen but i can't show the path of (the mail contains attachment) mail. Please help me

    Sorry for my bad english

    Thx..l


    Public Sub saveAttachtoDiskBEFNAT(itm As Outlook.MailItem)
    Dim objAtt As Outlook.Attachment
    Dim saveFolder As String
    saveFolder = "C:\Users\U077689\Desktop\FHB PAY"
    Dim filename As String


    filename = "BEF FONLARI NAKIT AKIS.xls"


    For Each objAtt In itm.Attachments


    Next
    If FileLen(???????) > 200 Then objAtt.SaveAsFile saveFolder & "\" & filename



    End Sub

  2. #2
    i am sure it would be easier to just check the filename of the attachments assuming only one excel workbook
    For Each objAtt In itm.Attachments
          if instr(objatt.filename, ".xls") > 0 then objAtt.SaveAsFile saveFolder & "\" & filename 
    Next

  3. #3
    VBAX Newbie
    Joined
    Sep 2014
    Posts
    2
    Location
    Quote Originally Posted by westconn1 View Post
    i am sure it would be easier to just check the filename of the attachments assuming only one excel workbook
    For Each objAtt In itm.Attachments
          if instr(objatt.filename, ".xls") > 0 then objAtt.SaveAsFile saveFolder & "\" & filename 
    Next
    It perfectly worked Thxxxxxx

Tags for this Thread

Posting Permissions

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