
Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
Greg, the solution to that problem is to add more characters to the
Cset argument of the .MoveEndUntil method. For example, to pick up
hyperlinks that end at either a space or a paragraph mark, use
oRng.MoveEndUntil Cset:=" " & vbCr, Count:=wdForward
Adding other punctuation to the list could be dangerous, since
periods, commas, question marks, and others could be legitimate parts
of some hyperlinks rather than stop characters.
For Andy, a word of explanation about why this approach is necessary:
When you type an address into a document, the part of Word that
recognizes the text and changes it into the hyperlink is the
"AutoFormat As You Type" feature (Tools > AutoCorrect Options >
AutoFormat As You Type > Internet and network paths with hyperlinks).
This feature is triggered *only* by typing on the keyboard, not by
anything you can do in VBA -- the Selection.TypeParagraph command
won't do it.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
>JGM,
>
[quoted text clipped - 96 lines]
>>
>> Look up the Add method for the Hyperlinks object for more options..
Greg Maxey - 28 Nov 2006 02:54 GMT
Jay,
Thanks. In view of what you just explained, wouldn't something like:
Sub ScratchMacro()
With Options
.AutoFormatAsYouTypeReplaceHyperlinks = True
.AutoFormatReplaceHyperlinks = True
End With
ActiveDocument.Range.AutoFormat
End Sub
Do a nice job of it?

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> Greg, the solution to that problem is to add more characters to the
> Cset argument of the .MoveEndUntil method. For example, to pick up
[quoted text clipped - 122 lines]
>>>
>>> Look up the Add method for the Hyperlinks object for more options..
Jay Freedman - 28 Nov 2006 04:08 GMT
>Jay,
>
[quoted text clipped - 9 lines]
>
>Do a nice job of it?
Yes it would, except that firing the AutoFormat could have a lot more
consequences than just creating the hyperlinks. It depends on what
else is checked in the AutoFormat options and what text that matches
in the document.
To be safe, you'd have to (a) save all the user's current AutoFormat
options in local variables, (b) set all of the AutoFormat options to
False except the .AutoFormatReplaceHyperlinks one, (c) fire the
AutoFormat method, and (d) put back the user's options to their
original state. Not difficult, but tedious.
Also, to achieve this, you don't need to work with
.AutoFormatAsYouTypeReplaceHyperlinks at all. It has no bearing on
what the macro does.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
Greg Maxey - 28 Nov 2006 05:36 GMT
Jay,
All true. I suppose what I really meant to say was that in view of what you
had pointed out, the simplest solution for the OP might be simply to set his
AutoFormat options appropriately and then AutoFormat. Leave VBA alone for
another day or another challenge ;-)

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
>> Jay,
>>
[quoted text clipped - 25 lines]
> .AutoFormatAsYouTypeReplaceHyperlinks at all. It has no bearing on
> what the macro does.
andysjunkmale@gmail.com - 28 Nov 2006 20:23 GMT
A big THANKS to everyone, but especially those who mentioned using
AutoFormat. That
was right on the mark. All I had to do was "re-run" autoformat. When I
did this,
all of the "dead" hyperlinks were activated. It looks like I was trying
to make this too complicated by using VBA :( Sometimes it pays to
keep it simple!
Andy
> Jay,
>
[quoted text clipped - 38 lines]
> > .AutoFormatAsYouTypeReplaceHyperlinks at all. It has no bearing on
> > what the macro does.
Jean-Guy Marcil - 28 Nov 2006 05:02 GMT
Jay Freedman was telling us:
Jay Freedman nous racontait que :
> Greg, the solution to that problem is to add more characters to the
> Cset argument of the .MoveEndUntil method. For example, to pick up
[quoted text clipped - 5 lines]
> periods, commas, question marks, and others could be legitimate parts
> of some hyperlinks rather than stop characters.
Silly me! I just assumed that the hyperlinks would be delimited by spaces...
Of course, you would have to check for more than that!

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org