当附件添加到项目中时发生。
Sub object_AttachmentAdd(Attachment As Attachment)
object 该对象的值为“应用于”列表中的一个对象。在 VBScript 中,用 Item 代替。
Attachment 必选。添加到项目中的 Attachment。
本 VBScript 示例在添加了嵌入附件后,检查项目的大小,并在项目大小超过 500,000 字节时显示警告信息。
Sub Item_AttachmentAdd(ByVal NewAttachment)
    If NewAttachment.Type = 1 Then
        Item.Save
        If Item.Size > 500000 Then
            MsgBox "Warning: Item size is now " & Item.Size & " bytes."
        End If
    End If
End Sub