Hi Greg,
There is something strange here.
While the following code does intercept the command that is run by selecting
Hyperlink from the Right Click Menu, as the Message Box is displayed, when
it is run that way, the ChangeFileOpenDirectory command is ignored. If
however the macro is run from Tools>Macro>Macros, then the
ChangeFileOpenDirectory command is taken into account:
Sub InsertHyperlink()
Dim BrowseFile As String
MsgBox "OK"
ChangeFileOpenDirectory "c:\Contract Documents\"
With Dialogs(wdDialogFileOpen)
If .Display <> -1 Then
Exit Sub
Else
BrowseFile = WordBasic.FileNameInfo$(.Name, 1)
End If
End With
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, _
Address:=BrowseFile, TextToDisplay:=Selection.Range.Text
End Sub
It's also a bit flaky in other ways.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Doug,
>
[quoted text clipped - 25 lines]
>> >
>> > Thanks a lot.
Jonathan West - 20 Dec 2006 21:21 GMT
> Hi Greg,
>
[quoted text clipped - 5 lines]
> ignored. If however the macro is run from Tools>Macro>Macros, then the
> ChangeFileOpenDirectory command is taken into account:
That may well be down to a timing issue. Word VBA occasionaly exhibits this
kind of problem for no immediately obvious reason.
It can often be addressed by putting a couple of DoEvents commands at a
strategic point in the macro, in this case probably immediately below the
ChangeFileOpenDirectory line

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
Greg Maxey - 20 Dec 2006 23:59 GMT
Doug,
Worked like a charm here using Word2007 and either method.
Thanks.
> Hi Greg,
>
[quoted text clipped - 60 lines]
> >> >
> >> > Thanks a lot.