簡體   English   中英

試圖撤回 Outlook 中的已發送消息

[英]Trying to recall a sent message in Outlook

我正在嘗試在 outlook 中獲取 vba 以調用當前選擇的消息。

我找到的代碼是。

Option Explicit
Sub Recall()
  Dim SendItem As Object
  Dim olItem As Outlook.MailItem
  Dim olInsp As Outlook.Inspector

  '// Selected item in Sent Items folder
  Set SendItem = ActiveExplorer.Selection.Item(1)

  If TypeName(SendItem) = "MailItem" Then
    Set olItem = SendItem
    Set olInsp = olItem.GetInspector
    '// Execute Recall command button
    With olInsp
      .Display
      .CommandBars.FindControl(, 2511).Execute
      .Close olDiscard
    End With
  End If
End Sub

我在.CommandBars.FindControl(, 2511).Execute行收到錯誤。 代碼應該如何修改?

命令欄已棄用,不再使用。 使用 Fluent UI(又名 Ribbon UI),因此任何舊代碼可能不再有效。 僅支持某些方法,例如ExecuteMso ,它允許執行內置的功能區控件。 CommandBars.ExecuteMso方法接受表示控件標識符的字符串。 您需要改為傳遞控件的功能區idMso值。

CommandBars.ExecuteMso("RecallThisMessage")

但您需要確保此類控件在 Outlook 中可用。單擊“發送”后,郵件撤回可用,並且僅當您和收件人在同一組織中擁有 Microsoft 365 或 Microsoft Exchange email 帳戶時才可用。 因此,例如,無法撤回發送至 Hotmail、Gmail 或 live.com 帳戶或從中發送的郵件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM