Microsoft Word and Microsoft Excel both have the ability to assist you in protecting your document's security. So lot's of document has password and writepassword. Office Viewer Component allows developers to open a password protected document without reminder message box. The component supports seamless integration with Office 97, Office 2000, Office 2003, Office 2007 and Office 2010.
Figure 1: Password Protected Reminder Dialog
Figure 1: WritePassword Protected Reminder Dialog
You can use the SetValue method to set password and writepassword property for the Word and Excel document before you call the Open method. It's better to add the SetValue method at the NotifyCtrlReady event or BeforeDocumentOpened event.
boolean SetValue([in] BSTR Name, [in] BSTR Value)
Sets the password, writepassword, domain and
protectmodereminder for the document.
Name: The name string.
Value: The value string.
The following vbscript shows how to open a password-protected document. if the 1.docx file has the password 1234, the writepassword 5678, you can use the follow sample.
EDOffice.SetValue "Password", "1234"
EDOffice.SetValue "WritePassword", "5678"