Unable to open word file (MSWord 2007) when word automation program is running

In my application i am using word automation to get the text content from the file. It is working fine no issues. But at the instant when word automation is processing, if i open the word file, it is throwing a dialog with message (any file)

"This file is in use by another application or user. (C:\User\xyz\AppData...\Normal.dotm)".

When I am closing the dialog, it is asking for save the file "normal.dotm"...template file.

This happens only in MSWord 2007 not in MSWord 2003. can any one tell the solution please.

Answers


This probably happens because one Word instance has locked Normal.dotm and your instance modifies it and tries to save it.

You can try to set the Saved property of your template to True. Try this: Application.NormalTemplate.Saved := True. Word will now think that changes to Normal.dotm are saved and should not try to save again.


Need Your Help

Remove trailing slash from comment form

php trailing-slash

I need code to remove the trailing slash when a user enters their link. For example I need them to put their url to grab their avatar, but in some cases they put their url ending with a slash (.com...