TechnicallyChris.com

Technical and Personal Ramblings of a Bostonian
  • Home
  • About Chris
  • Donate
  • Contact Chris
Home > Random Technology > Creating Hyperlinks in Word and Excel Longer than 256 Characters

Creating Hyperlinks in Word and Excel Longer than 256 Characters

August 20th, 2009
Goto comments Leave a comment

I recently came across an issue where I need to create a hyperlink in Microsoft Word 2003 that was roughly 300 characters long. Unfortunately, it appears that Microsoft had put some odd restriction in place on the maximum length of a hyperlink and it seemed I was out of luck. After a few minutes of googling turned up nothing, I was forced to find my own solution.

Although the Microsoft Word “Insert Hyperlink” box supports only 256 characters, I’ve found the underlying code supports far more. For this post, I’ll be testing with the following mock URL:

mockurl

The length of this URL exceeds the Microsoft Office limit. Notice here when I try and do an Insert->Hyperlink in a new Microsoft Word document and enter URL, it gets cut off far too early. Nothing can be typed after “endAt” in my mock URL below, and there are 73 characters left that I need to fit!

hyperlink_example

Now for the clever part. Instead of trying to insert the hyperlink from the Edit Menu, or editing your existing text to add the hyperlink, press the SPACE or ENTER key after you’ve type (or pasted) the hyperlink and let Microsoft Word convert it to a hyperlink for you, as shown here:

mockurl_aslink

If you right click on this text and select Edit Hyperlink, you’ll notice that Microsoft Word will now show you the full hyperlink address, including the missing 73 characters! While Microsoft wont let you type or paste a hyperlink beyond 256 characters into this box, it’s more than happy to put it in there itself.

hyperlink_example2

You can now change the Text To Display field to make the hyperlink say whatever you’d like, it will continue to direct your users to the long address.

In order to perform the same trick in Excel, create the hyperlink in Microsoft Word first and then copy and paste the hyperlink from the Word document into Excel. Do not try and paste the link into the formula field or you’ll just get the text. You’ll need to paste directly into a cell.

Update 17-Sept-2009: Commenter Michael reports that you can copy and paste long hyperlinks from Microsoft Word into Microsoft PowerPoint just like we were able to do for Excel.

If you enjoyed this article or it helped you in any way, I’d appreciate it if you’d post a comment below to let me know. All code examples are for demonstration only and should be used at your own risk. I cannot accept liability for unexpected results.

Chris Random Technology Microsoft Office, VBA

Comments (7) Trackbacks (0) Leave a comment Trackback
  1. jkd
    September 16th, 2009 at 10:20 | #1
    Reply | Quote

    This was exactly what I needed. Thanks!

  2. Craig
    September 17th, 2009 at 12:48 | #2
    Reply | Quote

    Thanks for this, it was very useful. My problem is slightly more complex – the URL is dynamic so I can’t paste it in. I don’t suppose you have some clever tip to persuade excel to allow more than 255 characters in a hyperlink formula ? I’ve tried splitting the URL into subsections but the HYPERLINK formula stops at 255 with a value error no matter what. If you have any thoughts, it would be wonderful. I am grasping at straws here.

  3. Michael
    September 17th, 2009 at 17:08 | #3
    Reply | Quote

    Perfect for me, Chris. I needed a very long link to an InfoPath form in a Form Library in SharePoint (which passes the form server, where to save to, etc.) to appear as a “Click Here” on the last slide at the end of a PowerPoint show. Your method above won’t work for me in PowerPoint, but if I go to Word first, paste the path, hit SPACE, then Edit the hyperlink to say “Click Here”, I can then copy and paste the hyperlink into PowerPoint! Thank you so much!

  4. Chris
    September 17th, 2009 at 18:56 | #4
    Reply | Quote

    @Craig
    Hi Craig, unfortunately I don’t think there’s a way around the 256 character limit in the built-in HYPERLINK function, but depending on your needs we could create some VBA that would create the hyperlinks for you. Could you tell me a bit more about situation? If you’d prefer to take this offline, you can use the CONTACT CHRIS link at the top of my blog to shoot me a message.

  5. Chris
    September 17th, 2009 at 18:57 | #5
    Reply | Quote

    @Michael
    Hi Michael, thanks for commenting, and for testing it out with Powerpoint! I’m going to update my post to let folks know that you’ve tested this successfully.

  6. Johnjac
    October 5th, 2009 at 15:58 | #6
    Reply | Quote

    This work around doesn’t seem to work for Work ‘08 for Mac OS. Anybody have any ideas?

  7. Patrick
    March 5th, 2010 at 05:24 | #7
    Reply | Quote

    Hi Chris,

    unfortunately Word and Excel 2003 cut the links at 512 characters, even using this workaround. Have you got another trick for me?

    I need to save links to reports within our Bugzilla-Clone and these Report URLs contain all the variables of the report. So they are very long. They range from 550 to 1000 characters.

    Any ideas?

    Kind Regards,
    Patrick

  1. No trackbacks yet.
Subscribe to comments feed
Updated PingCell Function for Excel Poker: The Real Deal by Phil Gordon
RSS feed
  • Google
  • Youdao
  • Xian Guo
  • Zhua Xia
  • My Yahoo!
  • newsgator
  • Bloglines
  • iNezha

Sponsored By

Recent Posts

  • Just Bought the Google Nexus One
  • Seven Things I’ve Liked About Windows 7 in Seven Day
  • What’s Happened to Customer Service (Part 2)?
  • What’s Happened to Customer Service (Part 1)?
  • Capturing S.M.A.R.T. Hard Disk Data from WMI with AutoIt
  • Adjusting DCOM Settings via Script
  • How to Manually Call the Google Cache
  • RoboForm & RoboForm2Go Product Review
  • Updated PingCell Function for Excel
  • Creating Hyperlinks in Word and Excel Longer than 256 Characters

Categories

  • ColdFusion
  • Firefox
  • Google Nexus One
  • IIS
  • McAfee EE / SafeBoot
  • Microsoft Windows
  • Oracle
  • Random Code
  • Random Technology
  • Sports and Recreation
  • Subversion
  • The Untechnological

Archives

  • January 2010
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • October 2007
  • September 2007
  • August 2007
  • January 2007
  • November 2006
  • October 2006
  • September 2006
  • August 2006
  • July 2006
  • June 2006
  • May 2006

Meta

  • Register
  • Log in
PageRank
Top WordPress
Copyright © 2006-2010 TechnicallyChris.com
Theme by mg12. Valid XHTML 1.1 and CSS 3.