try Dim doc = app.Documents.Open("d:\test.doc") If doc.ProtectionType <> 3 Then doc.Protect (Password:="123456", NoReset:=False, Type:=MsWord.WdProtectionType.wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=False) app.Documents.save End If
app.Visible = True catch ex As exception msgbox(ex.message) app.Quit finally