PDA

View Full Version : [SOLVED:] Get attachment size



olivetwist
07-02-2015, 12:13 PM
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?

skatonni
07-02-2015, 01:51 PM
There is a Size property for attachments.

https://msdn.microsoft.com/EN-US/library/office/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

olivetwist
07-06-2015, 04:30 AM
Thank you. I figured there was but couldn't get it right.