Word Err: "Word cannot complete the save due to a file permission

M

Miriam

Hi,

My windows application written in vb.net does: open word documents locally and merge data into it then save these documents to network shared drive. Most time the appliction works fine, occasionally it pops up the error message saying" Word cannot complete the save due to a file permission error C:\document and settings\...fileName", after dismisses the message box by click on "OK" application hangs.
The system is Windows 2000 server with .net framework 1.1. and having Office 2000 SR-1 and Word 2000 SR-1 installed on that server and non AntiVirus software installed on that machine.
in the code like
....
WordDoc.ActiveDocument.SaveAs(FileName:=fileName, FileFormat:=Word.WdSaveFormat.wdFormatDocument, _
AddtoRecentFiles:=False, SaveFormsData:=False)
....
How can I solve this problem. Please help me!!!


Thanks a lot.

Miriam
 
P

Peter Hewett

Hi Miriam

I don't know what's going on but I can make a few suggestions on how you might track it
down.

I note that you're running "Windows 2000 server", if you are trying to use Word as a
component in a server environment that may be the source of your problems. Word is
designed as a single user application whereas most stuff on a server is designed to be
mufti user. There is a KB article on the MS website about this restriction but I don't
have the number to hand.

If that's not the case then you need to try to get the problem to be consistently
reproducible. When you do the save are the file/directory permissions actually correct.
Maybe it's worth checking out what's in the folder your saving to and what the permissions
are before dismissing the error by clicking on "OK".

Just a comment on the code. I'd expect the variable "WordDoc" to be of type
"Word.Document". If that's the case then ".ActiveDocument" in the statement is invalid.
If "WordDoc" is of type "Word.Application" I'd rename it to something like "appWord" to
make your code more comprehensible.

HTH + Cheers - Peter
 
M

Miriam

Thank you Peter for your suggestions and quick response. I think I have to clarify something. My application actually is running with multithread process that means each thread starts and create a new word application object, I know office is a single thread application, so I use the Synclock when I work with the document each time ,like Open, insert, saveAs, and release the lock right after done any action, then quit word application after finishing all work with word. I have this problem only occasionally, and the directory the word document saved to has no problems most time.

Regards,

Miriam
 
P

Peter Hewett

Hi Miriam

You CANT run word in a multi-threaded process if more than one of the threads will
instantiate Word. Even using thread blocking/synchronisation techniques you can't
guarantee that multiple instance of Word are not interacting. From your post I'd guess
that this is what's happening.

I know from experience that it's possible to run Word from a system service, but I've
restricted that to a single thread. I would never contemplate a multi-threaded solution
utilising Word (and expect it to work consistently).

Good luck + Cheers - Peter


Thank you Peter for your suggestions and quick response. I think I have to clarify something. My application actually is running with multithread process that means each thread starts and create a new word application object, I know office is a single thread application, so I use the Synclock when I work with the document each time ,like Open, insert, saveAs, and release the lock right after done any action, then quit word application after finishing all work with word. I have this problem only occasionally, and the directory the word document saved to has no problems most time.

Regards,

Miriam

HTH + Cheers - Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top