| Barry MacDonnell's
Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
| Page updated Dec 2, 2020
|LinkToURL - Automates the creation of an active hyperlink in a WordPerfect document from a selected Internet address ("URL")|
Related pages -
• Hyperlinks - How to create hyperlinks (hypertext links) in WordPerfect
• HyperlinksFail - Why some hyperlinks (hypertext links) can fail to work while inside WordPerfect documents (.wpd, .wpt)
There are two basic issues the LinkToURL.wcm macro addresses (in WordPerfect 10 and later versions):
Under normal conditions if these two WordPerfect features are enabled (i.e., ticked) —
— then typical Internet website addresses (URLs), when pasted into WordPerfect and then immediately followed by a space character, will become active hyperlinks.
Problem: Some URLs will not be automatically
converted by WordPerfect.
Solution: The LinkToURL macro will create active hyperlinks of up to 235 characters. (But not longer: see Limitations... below.)
The standard way to create a
hyperlink to an Internet website address is to —
 select (or type) the text to make into a hyperlink in the document; then
 select the address in the browser or document; then
 copy the selected address to the clipboard (Ctrl+c); then
 click on Tools, Hyperlink; then
 paste the address (Ctrl+v) into the dialog's Document/Macro field; then
 click OK.
 Finally, you need to be sure that "Activate Hyperlinks" (under Tools, Settings, Environment) is enabled so that the links will work when you click on them.
[Note: The activation state (on/off) is stored with the document and will take precedence over this global setting. Moreover, it can be deliberately or accidentally turned off from the Hyperlink property bar (if it appears in your document), and the links can then fail to work. See "Why some hyperlinks can fail to work while inside WordPerfect documents."]
Solution: The LinkToURL macro reduces the steps to just the first three. Moreover, it can create either a hyperlinked word or phrase, or it can create a hyperlinked URL address (see Instructions).
This macro solves many problems (but not all: see below) with creating a hyperlink from a too-long Internet address, and it also eliminates at least two of the manual steps above (even more, if you must first copy and paste the URL into WordPerfect).
It will take either a currently selected Internet address(i.e., an URL) in a WordPerfect document, or if nothing was selected, the last item in the Windows clipboard (presumably, an URL selected in a web browser or other source and copied to the clipboard), and turn it into a clickable hyperlink at the current cursor location — all with a single mouse click.
Of course, this presumes you have just selected an Internet URL and not something else! (The macro will perform a rudimentary check to see if at least the four characters, "http," are present in the selected text.)
Be aware that the macro processes just one URL at a time, not a group of selected URLs.
Tip: See also "Why some hyperlinks can fail to work while inside WordPerfect documents."
Step 1. Beginning options:
Step 2. Select an URL from your
browser's address field or web page -
or in any document, including a WordPerfect document -
Step 3. Copy the selection to the Windows clipboard with Ctrl+c.
Step 4. Play the macro.
Tip: The macro can be assigned later to Ctrl+Alt+k, which is used by Microsoft Word for the same purpose, or any other available keyboard shortcut. See http://wptoolbox.com/tips/EasyPlay.html.Limitations, notes and tips
• Always test the results (a quick mouse click should do it).
There seems to be an internal character limit to the HypertextCreate() macro command. Therefore, this macro limits long URLs to 235 characters. And it may not work with some shorter URLs. But for most URLs it should make creating active hyperlinks a little easier.
• Once the link is created ...
... the Windows clipboard is emptied, ready for the next select-and-create-link operation. (This prevents accidentally pasting a previous selection of text between the paired [Hyperlink] codes when conducting multiple, sequential link operations during a session.)
You can disable this clipboard flushing feature with a setting in the redlined User Modification Area in the macro's code.
• Differences from the WordPerfect method:
Ordinarily, two WordPerfect options should be enabled to globally (a) activate all hyperlinks in WordPerfect and (b) (optionally) format Internet addresses as hyperlinks while you are typing them in a document: Activate Hyperlinks (under Tools, Settings, Environment), and Format words as hyperlinks when you type them (under Tools, QuickCorrect, SpeedLinks).
However, you do not need to turn on the global setting, Activate Hyperlinks, if you prefer it to be off. The macro will automatically activate the hyperlink (but for the current document only), regardless of that setting.
Also, you do not need to enable the SpeedLinks option, "Format words as hyperlinks as you type them," since this macro works on items that were already typed — presumably properly formatted — into a document, or on items that were selected in a web browser or similar source (hence, also presumably formatted as an URL). In fact, the macro can be used on long URLs that WordPerfect might not format as a hyperlink because of an internal limit on the maximum length of the URL.
• Make it easier to use:
The macro can be assigned later to Ctrl+Alt+k, which is used by Microsoft Word for the same purpose, or any other available keyboard shortcut. See http://wptoolbox.com/tips/EasyPlay.html.
• Related macros on this site:
▸ You might be interested in SoftWrap.wcm, which can format long URLs so that they wrap normally (i.e., break apart at logical places) if they are pushed to the end of a line, instead of wrapping as a block to the next line. SoftWrap can be played on a selected URL in WordPerfect either before or after playing LinkToURL on the same text.