Outlook VBA 创建指向特定 Outlook 对象的超链接
Outlook VBA to create a hyperlink to a specific Outlook object
我知道 Outlook 支持处理以下格式的超链接:
outlook:EntryID
在哪里
EntryID
是 olMail.EntryID
的值。
我想创建一个宏,它将 运行 在 Outlook 邮件项目上复制 outlook: 像这样的超链接作为超链接(而不是纯文本)到剪贴板。
构建 URL 字符串很容易,我可以使用 DataObject.SetText
和 DataObject.PutInClipboard
将 URL 作为计划文本放入剪贴板,但如何复制作为超链接到剪贴板的字符串?
在 C# 中我会尝试类似的东西:
SetText(String, TextDataFormat.Html)
其中 TextDataFormat
是 System.Windows.Forms.TextDataFormat
枚举中的一个值,但我不确定如何在 VBA.
中做同样的事情
谢谢
所有 .Net 剪贴板功能均基于 Windows API 函数。所以,你可以使用 SetClipboardData function in VBA which places data on the clipboard in a specified clipboard format. The first parameter can be a registered format or any of the standard clipboard formats. For more information, see Standard Clipboard Formats and Registered Clipboard Formats.
请注意,当项目移动到另一家商店时,条目 ID 会发生变化,例如,从您的收件箱到 Microsoft Exchange Server public 文件夹,或从一个个人文件夹 (.pst) 文件到另一个 .pst 文件。解决方案不应依赖于 EntryID 属性 是唯一的,除非项目不会被移动。此外,MAPI 商店提供者在其商店中创建项目时会分配一个唯一的 ID 字符串。这意味着您将在 PC 上获得不同的条目 ID。
我知道 Outlook 支持处理以下格式的超链接:
outlook:EntryID
在哪里
EntryID
是 olMail.EntryID
的值。
我想创建一个宏,它将 运行 在 Outlook 邮件项目上复制 outlook: 像这样的超链接作为超链接(而不是纯文本)到剪贴板。
构建 URL 字符串很容易,我可以使用 DataObject.SetText
和 DataObject.PutInClipboard
将 URL 作为计划文本放入剪贴板,但如何复制作为超链接到剪贴板的字符串?
在 C# 中我会尝试类似的东西:
SetText(String, TextDataFormat.Html)
其中 TextDataFormat
是 System.Windows.Forms.TextDataFormat
枚举中的一个值,但我不确定如何在 VBA.
谢谢
所有 .Net 剪贴板功能均基于 Windows API 函数。所以,你可以使用 SetClipboardData function in VBA which places data on the clipboard in a specified clipboard format. The first parameter can be a registered format or any of the standard clipboard formats. For more information, see Standard Clipboard Formats and Registered Clipboard Formats.
请注意,当项目移动到另一家商店时,条目 ID 会发生变化,例如,从您的收件箱到 Microsoft Exchange Server public 文件夹,或从一个个人文件夹 (.pst) 文件到另一个 .pst 文件。解决方案不应依赖于 EntryID 属性 是唯一的,除非项目不会被移动。此外,MAPI 商店提供者在其商店中创建项目时会分配一个唯一的 ID 字符串。这意味着您将在 PC 上获得不同的条目 ID。