Is it possible to make a word document ReadOnly in runtime after it has been opened in ReadWrite mode without closing it before?
Here is an example what I try to do:
Sub ProcessWordDoc()
Dim WordApp As New Word.Application
Dim Doc As Word.Document
WordApp.Visible = True
Set Doc = WordApp.Documents.Open(Filename:="C:\myWordTemplate.docx", ReadOnly:=False)
With Doc
.Unprotect
.FormFields("Firstname").Result = Me.Firstname
.FormFields("Lastname").Result = Me.Lastname
.Protect wdAllowOnlyReading
End With
' Make Doc ReadOnly after the document has been processed.
' Somthing like, but it does not work, since the ReadOnly property is read-only ;-)
Doc.ReadOnly = True
End Sub
So in a nutshell: is it possible to switch the mode of a word document via VBA from ReadWrite to ReadOnly?
Thanks for an help.