将突出显示的电子邮件转发给特定收件人

时间:2011-12-16 14:35:36

标签: outlook outlook-vba

如何将突出显示的电子邮件转发给特定收件人?

是否可以将其链接到CTRL-ALT-快捷方式?

我使用的是Windows 7,Outlook 2010

2 个答案:

答案 0 :(得分:1)

Ctrl + Alt似乎不是Outlook 2003的功能,因此我无法对其发表评论。我可以使用Tools,Customize将宏添加到工具栏来运行以下宏。

此宏将转发所有选定的项目。如果要确保只选择一个项目,请测试SelectedItems.Count。如果当前文件夹为空,则没有任何反应,因为SelectedItems.Count = 0

Sub ForwardSelectedItems()

  Dim Inx As Integer
  Dim NewItem As MailItem
  Dim SelectedItems As Outlook.Selection

  Set SelectedItems = ActiveExplorer.Selection

  For Inx = 1 To SelectedItems.Count
    Set NewItem = SelectedItems.Item(Inx).Forward
    With NewItem
      ' ##########   Remove following block if attachments are to be sent.
      ' Delete any attachments.
      With .Attachments
        While .Count > 0
          .Remove 1
        Wend
      End With
      ' ##########   Remove above block if attachments are to be sent.
      With .Recipients
      ' Add new recipient.  Note Forward deletes existing recipients.
        .Add "my.friend@isp.com"
      End With
      ' Choices   ######
      '.Display           ' Show to user and let them send if they wish
      .Send               ' Send automatically without showing to user
      ' End of choices  ######
    End With
  Next

End Sub

答案 1 :(得分:1)

  

将突出显示的电子邮件转发给特定收件人

返回当前突出显示的电子邮件:

GetCurrentItem会将当前选中或已打开的电子邮件返回给调用程序。

Function GetCurrentItem() As Object
' returns reference to current item, either the one
' selected (Explorer), or the one currently open (Inspector)

  Select Case True
  Case IsExplorer(Application.ActiveWindow)
    Set GetCurrentItem = ActiveExplorer.Selection.item(1)
  Case IsInspector(Application.ActiveWindow)
    Set GetCurrentItem = ActiveInspector.CurrentItem
  End Select

End Function
Function IsExplorer(itm As Object) As Boolean
  IsExplorer = (TypeName(itm) = "Explorer")
End Function
Function IsInspector(itm As Object) As Boolean
  IsInspector = (TypeName(itm) = "Inspector")
End Function

转发所选电子邮件:

这使用上述功能转发和显示电子邮件。其余的由你决定。

Sub FwdMail()

Dim obj As Object
Dim msg As Outlook.MailItem

Set obj = GetCurrentItem

If TypeName(obj) = "MailItem" Then
  Set msg = obj
  With msg
    .Forward
    .Display
  End With
End If

End Sub