How to have Copy Shortcut functionality in Word

  • Thread starter Thread starter Larry
  • Start date Start date
L

Larry

In the IE browser, in the Outlook express mail, you can right-click a
hyperlink and get the choice to "Copy Shortcut." You can then paste
that shortcut as an active hyperlink into any application, or paste it
into the IE address bar.

But Word 97 doesn't have this capability. If I right-click a web
hyperlink in a Word document, I don't get the Copy Shortcut option.
True, there is a Hyperlink submenu, and on that menu the option to "Copy
Hyperlink," but it does not work. If I run it, and open the Clipboard,
the Cliboard says "Cannot display. Data in Clipboard is in an unknown
format."

So, how can I add to word the very useful functionality of the Copy
Shortcut command.

Thanks,
Larry
 
Hi, Larry,

The Copy Hyperlink command does work, but it copies a HYPERLINK field,
not plain text. That means you can't paste the result anywhere -- such
as the IE address box or Notepad -- that doesn't know how to handle a
Word field. If you use the command and then paste *into Word* it works
just fine.

To get what you want, the text of the URL in the hyperlink, put this
macro into a global template and add a shortcut-menu item for it.

Sub CopyHyperlinkText()
If Selection.Hyperlinks.Count = 0 Then
Exit Sub
End If

Dim MyData As DataObject
Dim strURL As String

strURL = Selection.Hyperlinks(1).Address
Set MyData = New DataObject

MyData.SetText strURL
MyData.PutInClipboard
End Sub
 
Jay,

I just came upon your reply now, a month late.

That's a great little addition to Word. Thanks much.

Also, I see that with this code it's possible to put things into the
clipboard that are not even selected.

Larry
 
Back
Top