5

Is it possible to create a quick part that autoreplaces a string with an hyperlink in Outlook 2010? I would like to avoid the vba used in the question Convert Plain Text to Hyperlink in Outlook .

Example

  • if I type (and press F3)

google something

  • It replaces it with the hyperlink

something

Which links to:

https://www.google.nl/?q=something#newwindow=1&q=something
spoorcc
  • 103
  • 7
  • You may avoid VBA *and* quick-parts by using [AutoHotkey](http://www.autohotkey.com/) to create a shortcut macro that issues the keys that do the job. – harrymc Dec 07 '13 at 16:51
  • Although I like the idea and would go with the solution if it was my private computer, I'm not allowed to install software, without a lot of approvals and lengthy procedures at work. – spoorcc Dec 07 '13 at 17:31
  • AHK is portable so doesn't require installation. The file AutoHotkey.exe is all that is needed to launch any .ahk script. – harrymc Dec 07 '13 at 17:50
  • I'm still curious if there is a outlook only solution, but thank you for your answers. – spoorcc Dec 08 '13 at 08:49

1 Answers1

1

You may avoid VBA and quick-parts by using AutoHotkey to create a shortcut macro that issues the keys that do the job.

But since you ask for an Outlook solution, here is a simple (and even somewhat tested) VBA macro to convert the currently selected text to a hyperlink of the type you requested:

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
harrymc
  • 455,459
  • 31
  • 526
  • 924
  • Will try it, but is there no solution outside using vba's or external software? Something like autoreplace in Word? – spoorcc Dec 08 '13 at 21:43
  • As far as I know, Outlook has no such in-built capabilities. As Quick Parts do not accept parameters they are not a solution. – harrymc Dec 09 '13 at 06:42
  • I'm not allowed to use vba at work *sigh*, but since I assume your answer covers the functionality I want, I'll accept your answer. – spoorcc Dec 13 '13 at 15:52
  • You could still go in the direction of a AutoHotkey macro. – harrymc Dec 13 '13 at 17:31