shg
MrExcel MVP
- Joined
- May 7, 2008
- Messages
- 21,841
- Office Version
- 2010
- Platform
- Windows
I frequently send emails (from Outlook) like this:
Kenny, Tim,
[Some document name] is on the share.
I copy the path on the share, select the words "on the share" in the email, right-click, select Hyperlink, and paste from the clipboard into the Address textbox. A macro would be handy.
Outlook uses Word as an editor, and this does what I want in Word:
I'd be grateful if some kind soul would show me how to code it for Outlook.
Now cross-posted at ExcelForum
Kenny, Tim,
[Some document name] is on the share.
I copy the path on the share, select the words "on the share" in the email, right-click, select Hyperlink, and paste from the clipboard into the Address textbox. A macro would be handy.
Outlook uses Word as an editor, and this does what I want in Word:
VBA Code:
Sub OnTheShare()
' Adds a hyperlink with the text "on the share" at the
' insertion point to the path on the clipboard
' Shortcut Ctrl+Shift+O
Dim oDO As Object
Dim sAddr As String
Set oDO = CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
oDO.GetFromClipboard
On Error Resume Next
sAddr = oDO.GetText
On Error GoTo 0
If Len(sAddr) Then
ActiveDocument.Hyperlinks.Add _
Anchor:=Selection.Range, _
Address:=sAddr, _
SubAddress:="", _
ScreenTip:="", _
TextToDisplay:="on the share"
Else
MsgBox Prompt:="Nothing on clipboard!", _
Title:="OnTheShare"
End If
End Sub
Now cross-posted at ExcelForum
Last edited: