The previous version control to host an password protected word or excel instance. This works nicely except that if a user tries to open a document, then this document is opened in my hosted instance of word. How can I prevent this behavior?

The Edraw Excel Viewer Component and Word Viewer Component V7 support to open password protected word and excel file programmatically. You need call the SetValue method to set the password and writepassword before you call the Open method.

boolean SetValue([in] BSTR Name, [in] BSTR Value);
Sets the pasword, writepassword, domain and protectmodereminder for the document.
Name: The name string.
Value: The value string.

Example

The following vb script 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.

Sub SetValue_Example()
edword.SetValue “Password”, “1234”
edword.SetValue “WritePassword”, “5678”
edword.Open “c:\1.docx”
End Sub