Consulting

Results 1 to 3 of 3

Thread: Get attachment size

  1. #1

    Get attachment size

    I currently have code to save an attachment if it is an excel file to a certain folder. I am trying to find a way to add the option to save only if the attachment is over a certain size. what can I use to check the incoming attachment size?

  2. #2
    VBAX Mentor skatonni's Avatar
    Joined
    Jun 2006
    Posts
    347
    Location
    There is a Size property for attachments.

    https://msdn.microsoft.com/EN-US/lib.../ff866906.aspx

    Option Explicit
    
    Sub attSize()
    
    Dim currItem As Object
    Dim oAtt As attachment
    
    Set currItem = ActiveInspector.currentItem
    
    Debug.Print vbCr & currItem.Subject
    
    For Each oAtt In currItem.Attachments
        Debug.Print " Display Name: " & oAtt.DisplayName & vbCr & " Size: " & oAtt.Size
    Next oAtt
    
    End Sub
    To debug, mouse-click anywhere in the code. Press F8 repeatedly to step through the code. http://www.cpearson.com/excel/DebuggingVBA.aspx

    If your problem has been solved in your thread, mark the thread "Solved" by going to the "Thread Tools" dropdown at the top of the thread. You might also consider rating the thread by going to the "Rate Thread" dropdown.

  3. #3
    Thank you. I figured there was but couldn't get it right.

Posting Permissions

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