Kedves TBalazs,
If you have an anti virus application running with auto-protection, it passibly don't allow to run this code (virus alert). It creates a new doc file, inserts a new module, a new sub that read-only opens the current file and closes oneself.
Insert these subs into a module:
'****************************************************************************************************************
Sub AutoOpen()
If Not Application.ActiveDocument.ReadOnly Then
Call MakeReadOnlyDoc(ActiveDocument.Name, ActiveDocument.Path & "\" & ActiveDocument.Name)
End If
End Sub
Sub MakeReadOnlyDoc(myName, openDocName)
Dim myDoc, myModule As Object
Set myDoc = Application.Documents.Add
Set myModule = myDoc.VBProject.VBComponents.Add(vbext_ct_StdModule)
myModule.CodeModule.AddFromString "Public Sub mySub()" & vbLf & _
"on error resume next" & vbLf & _
"'Documents(" & Chr(34) & myName & Chr(34) & "

.Close False 'it not need.." & vbLf & _
"set MyDoc=activedocument" & vbLf & _
"Documents.Open " & Chr(34) & openDocName & Chr(34) & ", False, True, True" & vbLf & _
"myDoc.close False" & vbLf & _
"end sub"
Application.Run "mySub"
End Sub
i hope it suits for you
ide