hyperlink url truncated...

S

shesh

hi;
i've got a *really* long URL to docs within a doc repository. when i try to
Insert Hyperlink and enter the URL in the address text box, Word truncates it.

i've looked for some length setting but can't find it anywhere.

how can i enter long urls?

It seems that in prev revs of word, one could have a base URL - but in 2007
how does set a base URL ?
 
J

Jay Freedman

hi;
i've got a *really* long URL to docs within a doc repository. when i try to
Insert Hyperlink and enter the URL in the address text box, Word truncates it.

i've looked for some length setting but can't find it anywhere.

how can i enter long urls?

The longest URL you can enter through the Insert Hyperlink dialog is
probably somewhere between 250 and 255 characters, but I think that's
just a limitation of the dialog. You should be able to enter a longer
URL by creating a macro. Before we go to that trouble, though...
It seems that in prev revs of word, one could have a base URL - but in 2007
how does set a base URL ?

If a hyperlink base will serve your purpose, here's how to get to that
spot.

The short way: Right-click the Quick Access Toolbar and choose
Customize. Set the category to Commands Not In the Ribbon. Click on
Advanced Document Properties, click the Add button in the middle of
the dialog, and click OK. Now click the new button on the Quick Access
Toolbar.

The long way: Click the Office button > Prepare > Properties to open
the semi-brain-dead(*) properties pane. Click the Document Properties
button (next to the i-in-circle icon) and choose Advanced Document
Properties.

Either way, you get the same Properties dialog that was in earlier
versions. Go to the Summary tab and enter the hyperlink base.

(*) This properties pane is really just a placeholder for a more
comprehensive InfoPath pane that could be created by a developer. I'd
be willing to bet that not more than 0.001% of all Word 2007
installations have ever been treated that way, and the rest of us have
to put up with this useless thing.
 
S

Suzanne S. Barnhill

I'm glad I'm not the only one who considers the properties pane a real PITA.
The Properties button was one of the first I added to my QAT; too bad I
can't use the same button icon I have in Word 2003, but at least the Word
2007 command *has* a button icon, and I've put it in the same place I have
it on the 2003 toolbar.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
 
S

shesh

Thank you Jay - that was *most* helpful and it worked - quite beautifully. I
know i'd searched for the doc props dialog box many times - boy its well
hidden...

could you also "teach" or point to how to use macros to enter any length URL
w/o showing the URL but some other text as display text ?

have a *great* day!

Kindest regards,
S-
 
J

Jay Freedman

I was slightly low on my estimate of the capacity of the Insert
Hyperlink dialog: by experiment, it can handle up to 256 characters.

This macro should work for longer URLs, at least as a proof of
concept:

Sub HyperlinkForLongUrl()
Dim LongString As String
Dim hl As Hyperlink

Selection.MoveEndWhile Cset:=vbCr, Count:=wdBackward
LongString = Selection.Text

Set hl = ActiveDocument.Hyperlinks.Add( _
Anchor:=Selection.Range, _
Address:=LongString, _
TextToDisplay:="hyperlink")

hl.TextToDisplay = InputBox("Enter text to display:")
End Sub

Paste or type the long URL as plain text in the document, select it,
and run the macro. It will create a hyperlink with the full URL, and
then pop up a box to ask for the display text.

I've tested this up to 300 characters. Feel free to torture it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top