Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to include a URL in word document, both as text people can read, and a link they can click. The URL has a hyphen in it. I don't want the URL to get broken across lines.

When I use a regular hyphen, the link works, but the text displayed gets broken.

When I use a non-breaking hyphen (Ctrl+Shift+-) Word removes the hyphen from the link.

When I try and manually edit the hyperlink, I can't add a non-breaking hyphen into the Text to display field using Ctrl+Shift+-.

If I was writing this is HTML I could just do:

<a href="http://www.my-link.com/">www.my&#8209;link.com</a>

How do I get Word to do the equivalent?

share|improve this question
    
Non-breaking hyphens are not supported in HTML so Word won't let you put one in the text portion of a hyperlink. –  martineau Sep 19 '12 at 18:58

2 Answers 2

up vote 1 down vote accepted

I have an older version of Word but it has the same problem. I was able to workaround the limitation by holding down the Alt key and typing 030 on the numeric keypad then releasing the Alt Key at the spot I wanted the non-breaking hyphen. Afterwards I had to manually select and make the displayed text into a hyperlink with the proper href value. It may also be necessary or helpful to turn off the Auto-Formatting of Hyperlinks in Auto-Correct Options.

screenshot show Word not breaking a hyperlink after a hypen

share|improve this answer
    
Hmm- I don't have a numeric keypad on my laptop, and when I press Alt, I get all the Alt keys displayed on the menu items. :-( –  dunxd Jul 20 at 16:58
1  
@dunxd: My laptop also lacks a numeric keypad. However there;s a virtual one composed of keys from several rows to the right of the center of the keyboard. These key all have a blue digit on them in addition to the normal letter. If I hold down the Fn key, those keys all become the digit shown on them. So, to simulate having a numeric keyboard, I need to first press and hold the Fn key, then also press the Alt key, before pressing the keys for 030. An viable alternative to all this fancy keyboarding would be to use something like AutoHotkey and make a macro. –  martineau Jul 20 at 17:29
    
Thanks - I don't think I ever figured out how to use that at feature on my laptop till now. And extra thanks for coming back to a question from nearly three years back! Super User just keeps on giving! –  dunxd Jul 24 at 22:42
    
You're welcome. Surprised you recalled your nearly 3 year old question. Since writing my original answer I've upgraded to Word 2013 and can now use Ctrl+Shift+- to enter non-breaking hyphens into the text-to-display portion of the hyperlink edit dialog box (although what's in my answer still works, too). –  martineau Jul 25 at 1:57

I'm using word 2013. Here is something that seems to work for me.

  1. insert a hyperlink: something/foo-bar/otherthing
  2. in the text of the document, go to the hyphen and replace it with a non-breaking hyphen (ctrl-shift-"-")
  3. edit the hyperlink:
    • in the "Text to display" text box you have something like:
      something/foo bar/otherthing
    • in the "Address" text box you have something like:
      something/foo%1ebar/otherthing
  4. in the "Text to display" text box, select "foo bar"
  5. copy this to the clipboard (ctrl-"c")
  6. in the "Address" text box, replace the "%1e" with a hyphen
    (this is also changing the "Text to display" text box ....)
  7. in the "Text to display" text box, select "foo-bar" and paste what you selected in 4)-5) from the clipboard (ctrl-v)
share|improve this answer
    
When I try this in Word 2010, it appears to work, but when I follow the link, it has removed the hyphen completely, and when I edit it again it has replaced the Address with something/foo%1ebar/otherthing rather than something/foo-bar/otherthing –  dunxd Jul 20 at 16:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.