在 Outlook 2010 中使用快速部件自动替换带有超链接的字符串

spo*_*rcc 5 microsoft-outlook microsoft-outlook-2010

是否可以创建一个快速部件,在 Outlook 2010 中用超链接自动替换字符串?我想避免在问题Convert Plain Text to Hyperlink in Outlook 中使用的 vba 。

例子

  • 如果我输入(并按 F3)

谷歌的东西

  • 它用超链接替换它

某物

链接到:

https://www.google.nl/?q=something#newwindow=1&q=something
Run Code Online (Sandbox Code Playgroud)

har*_*ymc 1

您可以使用AutoHotkey创建一个发出执行该工作的按键的快捷方式宏,从而避免使用 VBA 和快速部件。

但由于您需要 Outlook 解决方案,这里有一个简单(甚至经过一些测试)的 VBA 宏,用于将当前选定的文本转换为您请求的类型的超链接:

Sub SelectionToHyperlink()
' Convert the current selection to a hyperlink
If ActiveInspector.EditorType = olEditorText Then
    MsgBox "Can't add links to textual mail"
    Exit Sub
End If
Dim doc As Object
Dim sel As Object
Set doc = ActiveInspector.WordEditor
Set sel = doc.Application.Selection
doc.Hyperlinks.Add Anchor:=sel.Range, _
    Address:="https://www.google.nl/?newwindow=1&q=" & sel.Text, _
    SubAddress:="", _
    ScreenTip:="", _
    TextToDisplay:=sel.Text
End Sub
Run Code Online (Sandbox Code Playgroud)