Hi all,

I am trying to write a code that checks if opened document is readonly or not. Below is the code that I used:


Dim objWord As Word.Application

Set objWord = New Word.Application

If objWord.Documents("filename").ReadOnly Then
'document is readonly'
Else
'document is not readonly'
End If


It seems like object does not recognize the open document.
However, if I use same method for Powerpoint presentation, code works perfectly fine.

Does anyone have idea why above code does not work?

Thank you very much for your time.

Charles

*Microsoft Word object library is properly referenced.