Outlook VBA教程:Attachments属性

返回Attachments对象,代表指定项目的所有附件。

expression.Attachments

expression  必选。该表达式返回“应用于”列表中的一个对象。

VBA示例

本 Visual Basic for Applications 示例在将转发的邮件发送给 John Y.Chen 之前,使用Remove方法删除其中的所有附件。


Set myOlApp = CreateObject("Outlook.Application")
Set myinspector = myOlApp.ActiveInspector
If Not TypeName(myinspector) = "Nothing" Then
      Set myitem = myinspector.CurrentItem.Forward
      Set myattachments = myitem.attachments
        If Not TypeName(myattachments) = "Nothing" Then
         While myattachments.Count > 0
             myattachments.Remove 1
         Wend
         myitem.Recipients.Add "John Y. Chen"
         myitem.Send
        End If
   MsgBox "The current item is not of the correct type"
Else
  MsgBox "There is no active Inspector"
End If

如果使用 VBScript,则不必创建Application对象。本示例说明如何使用 VBScript 执行相同任务。


Set myinspector = Application.ActiveInspector
If Not TypeName(myinspector) = "Nothing" Then
      Set myitem = myinspector.CurrentItem.Forward
      Set myattachments = myitem.attachments
        If Not TypeName(myattachments) = "Nothing" Then
         While myattachments.Count > 0
             myattachments.Remove 1
         Wend
         myitem.Recipients.Add "John Y. Chen"
         myitem.Send
        End If
   MsgBox "The current item is not of the correct type"
Else
  MsgBox "There is no active Inspector"
End If

上页:Outlook VBA教程:AssistantTelephoneNumber属性 下页:Outlook VBA教程:AutoForwarded属性

Outlook VBA教程:Attachments属性:相关链接

Outlook VBA教程:AutoForwarded属性 Outlook VBA教程:AutoResponse属性
Outlook VBA教程:BCC属性 Outlook VBA教程:BillingInformation属性
Outlook VBA教程:Birthday属性 Outlook VBA教程:Body属性
Outlook VBA教程:BodyFormat属性 Outlook VBA教程:Business2TelephoneNumber属性
Outlook VBA教程:BusinessAddress属性 Outlook VBA教程:BusinessAddressCity属性
Outlook VBA教程:BusinessAddressCountry属性 Outlook VBA教程:BusinessAddressPostalCode属性
Outlook VBA教程:BusinessAddressPostOfficeBox属性 Outlook VBA教程:BusinessAddressState属性
Outlook VBA教程:BusinessAddressStreet属性 Outlook VBA教程:BusinessFaxNumber属性
Outlook VBA教程:BusinessHomePage属性 Outlook VBA教程:BusinessTelephoneNumber属性
Outlook VBA教程:BusyStatus属性 Outlook VBA教程:CallbackTelephoneNumber属性
版权所有 © 中山市飞娥软件工作室 证书:粤ICP备09170368号