Link to home
Start Free TrialLog in
Avatar of MonteDelMar
MonteDelMar

asked on

Persistent 'File is in use' message when trying to attach a new template to a document

Hi Experts

I am having a problem with the above. This is a 100+ user installation and each user has their own set of templates. In certain circumstances, we automate changing a document's attached template. The problem is that the system *always* says that the template we are trying to attach - not always the same one - is in use. It definitely isn't. I have hidden and system files displayed and there is no 'owner' file. I also have code to unhide an owner file and to delete it if it exists.

Today I have created a brand new template via VBA code and saved it as a .dotx (so that it is not based on an existing template). It has never been used or opened other than that. When I try to attach that template to the document via VBA, it tells me it is in use. The code itself is tried and tested in other installations.

Only one instance of Word is running.

The code I am using is:   .AttachedTemplate = full name of the template including path.

All the templates concerned are in the users' User Template path.

I have also changed the view in File Explorer so that it does not use 'Details' or use the 'Preview' pane. Closed and restarted Word a million times. I've tried slowing down the code too. Nothing seems to make a difference.

Please, does anyone have any other suggestions? Any ideas gratefully received.

Many thanks in advance.
Avatar of Jackie Man
Jackie Man
Flag of Hong Kong image

Have you tried to disable the preview pane?
Use Process Explorer to determine what is using the File.
Avatar of MonteDelMar
MonteDelMar

ASKER

Jackie Man - yes I have but thank you for the suggestion.

Strivoli - I will try that. Thank you.
Hi

I ran Process Explorer for the 2 files in question. As you can see below, each returns two results. As far as I can see, they are exactly the same except that one is all in lower case and the other not. I have not used Process Explore before. Forgive the stupid question but ... is this something it does or does this suggest that the files really are in use (in a parallel universe?).
User generated imageMany thanks.

They are really in use. Check where's the PID 6008. Perhaps it was launched by a User or by a Parent Process.
In the example below the PID 4480 is a Child of Explorer which belogs to me. So, I opened Word.
User generated image
Thank you for explaining :-)
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.