Help with Word error "does not understand the message"

I am trying to use applescript to unprotect a password-protected Microsoft Word document. I have the password. I am using the script below with the example password “pass.” Applescript gives me an error that says

Anyone know what the problem may be? This is with Word 2011 on Yosemite.

set theDoc to (choose file)
tell application "Microsoft Word"
	unprotect theDoc password "pass"
end tell

Hi,

the error message says, Word cannot unprotect an object of class alias, which belongs to the file system.
The direct parameter of unprotect must be of class (Word) document, do you have to open the file,
something like this


set theDoc to (choose file)
tell application "Microsoft Word"
	open theDoc
	unprotect front document password "pass"
end tell

probably you also have to re-save the file

Thank you for the reply. That does not do it. It tries to open the doc and then I am showed the password dialog for opening the file. So, the Applescript is never able to open the file unless I manually type in the password. I am hoping for something requiring no interaction from me. I tried to script the password entry with the following modified script, but it does not work - still get showed the password dialog. Any other ideas?

It seems that having the option to provide the password to the unprotect message indicates that protection can be removed without opening the file, but I could be wrong.

set theDoc to (choose file)
tell application "Microsoft Word"
	open theDoc password document "pass"
	unprotect front document password "pass"
end tell

This is obviously the solution, but the file has to be opened anyway