Oharra
Orrialde honetara sartzeak baimena behar du. Saioa hasteko edo direktorioak aldatzen saia zaitezke.
Orrialde honetara sartzeak baimena behar du. Direktorioak aldatzen saia zaitezke.
Se produce cuando se han agregado datos adjuntos a una instancia del objeto primario.
Sintaxis
expresión.
AttachmentAdd( _Attachment_ )
expresión Variable que representa un objeto TaskItem .
Parameters
| Nombre | Obligatorio/opcional | Tipo de datos | Descripción |
|---|---|---|---|
| Dato adjunto | Obligatorio | Datos adjuntos | Datos adjuntos que se ha agregado al elemento. |
Ejemplo
En este ejemplo de Visual Basic para Aplicaciones (VBA) se comprueba el tamaño de un elemento después de agregar datos adjuntos y se muestra un aviso si el tamaño excede de 500.000 bytes. El código de ejemplo debe colocarse en un módulo de clase como ThisOutlookSession, y se debe llamar al TestAttachAdd() procedimiento antes de que Microsoft Outlook pueda llamar al procedimiento de evento.
Public WithEvents newItem As Outlook.MailItem
Private Sub newItem_AttachmentAdd(ByVal newAttachment As Attachment)
If newAttachment.Type = olByValue Then
newItem.Save
If newItem.Size > 500000 Then
MsgBox "Warning: Item size is now " & newItem.Size & " bytes."
End If
End If
End Sub
Public Sub TestAttachAdd()
Dim atts As Outlook.Attachments
Dim newAttachment As Outlook.Attachment
Set newItem = Application.CreateItem(olMailItem)
newItem.Subject = "Test attachment"
Set atts = newItem.Attachments
Set newAttachment = atts.Add("C:\Test.txt", olByValue)
End Sub
Vea también
Soporte técnico y comentarios
¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.