This will do what you want. However, it's not clear to me yet how you
would unset the ReadOnly atttribute by VBA once you've set it. The
comments explain the macro step by step.
Sub SetLinkedDocToReadOnlyAndOpen()
' First Step. Get the address of the document in the hyperlink.
' (Part of this code was provided by Jay Freedman last year.)
' Copies text of selected hyperlink into the clipboard.
' The hyperlink doesn't have to be completely selected.
' If cursor is in the hyperlink, of if you right-click the Hyperlink
' and have installed this macro in the Hyperlink shortcut menu, this
will work.
System.Cursor = wdCursorIBeam
' If no hyperlink is selected, the macro will stop.
If Selection.Hyperlinks.Count = 0 Then
MsgBox "No hyperlink is selected."
Exit Sub
End If
Dim MyData As DataObject
Dim strURL As String
strURL = Selection.Hyperlinks(1).Address
Set MyData = New DataObject
Set oDataObject = New DataObject
MyData.SetText strURL
MyData.PutInClipboard
Dim sAddress As String
' Get the document's address from Clipborad, assign address to variable,
set the ReadOnly attribute.
oDataObject.GetFromClipboard
sAddress = oDataObject.GetText
SetAttr sAddress, vbReadOnly
' You can comment out this message box.
MsgBox sAddress & " has been set to Read Only"
' Open the document.
Application.Run "HyperlinkOpen"
End Sub
Larry